Skip to content

Commit

Permalink
fix: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzcarey committed Nov 10, 2023
1 parent 52fd47a commit ef8d116
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion services/core/constructs/aspects/RemovalPolicyAspect.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CfnResource, IAspect, RemovalPolicy } from "aws-cdk-lib";
import { IConstruct } from "constructs";

import { isProduction } from "../../../helpers";
import { isProduction } from "../../env-helpers";

export class RemovalPolicyAspect implements IAspect {
visit(node: IConstruct): void {
Expand Down
20 changes: 16 additions & 4 deletions services/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"aws-cdk-lib": "2.86.0",
"axios": "^1.5.0",
"constructs": "^10.0.0",
"dotenv": "^16.3.1",
"dynamodb-toolbox": "^0.8.5",
"esbuild": "0.19.1",
"probot": "^12.3.1",
Expand Down
5 changes: 4 additions & 1 deletion services/core/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env node
import { App, Aspects, Tags } from "aws-cdk-lib";
import * as dotenv from "dotenv";

import { WebhookStack } from "./stack";
import { RemovalPolicyAspect } from "../constructs/aspects";
import { getRegion, getStage } from "../env-helpers";

dotenv.config();

const app = new App();

//Env
Expand All @@ -14,7 +17,7 @@ const region = getRegion();
//Stacks
new WebhookStack(app, `${stage}-crgpt-webhook`, {
stage,
env: { region },
env: { region, account: process.env.CDK_DEFAULT_ACCOUNT },
});

//Aspects
Expand Down
10 changes: 2 additions & 8 deletions services/core/resources/stack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CfnOutput, Stack, StackProps } from "aws-cdk-lib";
import { Stack, StackProps } from "aws-cdk-lib";
import { LambdaIntegration } from "aws-cdk-lib/aws-apigateway";
import { Table } from "aws-cdk-lib/aws-dynamodb";
import { Construct } from "constructs";
Expand Down Expand Up @@ -32,13 +32,7 @@ export class WebhookStack extends Stack {
const webhookLambda = new WebhookLambda(this, "webhook-lambda");

//Routes
const webhookRoute = api.root.addResource("/api/github/webhooks");
const webhookRoute = api.root.addResource("webhook");
webhookRoute.addMethod("POST", new LambdaIntegration(webhookLambda));

//Exports
new CfnOutput(this, "webhookUrl", {
value: api.url,
exportName: `${props.stage}WebhookUrl`,
});
}
}

0 comments on commit ef8d116

Please sign in to comment.