-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.ts
36 lines (29 loc) · 1.01 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";
import FanoutGraphqlAwsApp from "./api/_lib/FanoutGraphqlAwsApp";
const pulumiConfig = new pulumi.Config("fanout.io-lambda-demo");
const configFromPulumi = {
gripUrl: pulumiConfig.get("gripUrl"),
// common name prefix for all pulumi component names, e.g. 'dev'
name: pulumiConfig.require("name"),
};
const config = {
// like https://api.fanout.io/realm/{realm-id}?iss={realm-id}&key=base64:{realm-key}
gripUrl: process.env.GRIP_URL || configFromPulumi.gripUrl,
name: configFromPulumi.name,
};
const fanoutGraphqlAwsAppPulumiName = config.name;
const fanoutGraphqlAwsApp = FanoutGraphqlAwsApp(
`${fanoutGraphqlAwsAppPulumiName}-lambda`,
{
grip: config.gripUrl ? { url: config.gripUrl } : false,
},
);
const endpoint = new awsx.apigateway.API(
`${fanoutGraphqlAwsAppPulumiName}-api-gateway`,
{
routes: fanoutGraphqlAwsApp.routes,
},
);
/** URL of FanoutGraphglAwsApp API Gateway */
export const url = endpoint.url;