condition check lambda
This commit is contained in:
63
infrastructure/cdk/bin/app.ts
Normal file
63
infrastructure/cdk/bin/app.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env node
|
||||
import "source-map-support/register";
|
||||
import * as cdk from "aws-cdk-lib";
|
||||
import { ConditionCheckLambdaStack } from "../lib/condition-check-lambda-stack";
|
||||
|
||||
const app = new cdk.App();
|
||||
|
||||
// Get environment from context or default to staging
|
||||
const environment = app.node.tryGetContext("env") || "staging";
|
||||
|
||||
// Environment-specific configurations
|
||||
const envConfig: Record<
|
||||
string,
|
||||
{
|
||||
databaseUrl: string;
|
||||
frontendUrl: string;
|
||||
sesFromEmail: string;
|
||||
emailEnabled: boolean;
|
||||
}
|
||||
> = {
|
||||
staging: {
|
||||
// These should be passed via CDK context or SSM parameters in production
|
||||
databaseUrl:
|
||||
process.env.DATABASE_URL ||
|
||||
"postgresql://user:password@localhost:5432/rentall_staging",
|
||||
frontendUrl: "https://staging.villageshare.app",
|
||||
sesFromEmail: "noreply@villageshare.app",
|
||||
emailEnabled: true,
|
||||
},
|
||||
prod: {
|
||||
databaseUrl:
|
||||
process.env.DATABASE_URL ||
|
||||
"postgresql://user:password@localhost:5432/rentall_prod",
|
||||
frontendUrl: "https://villageshare.app",
|
||||
sesFromEmail: "noreply@villageshare.app",
|
||||
emailEnabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
const config = envConfig[environment];
|
||||
|
||||
if (!config) {
|
||||
throw new Error(`Unknown environment: ${environment}`);
|
||||
}
|
||||
|
||||
// Create the Lambda stack
|
||||
new ConditionCheckLambdaStack(app, `ConditionCheckLambdaStack-${environment}`, {
|
||||
environment,
|
||||
databaseUrl: config.databaseUrl,
|
||||
frontendUrl: config.frontendUrl,
|
||||
sesFromEmail: config.sesFromEmail,
|
||||
emailEnabled: config.emailEnabled,
|
||||
env: {
|
||||
account: process.env.CDK_DEFAULT_ACCOUNT,
|
||||
region: process.env.CDK_DEFAULT_REGION || "us-east-1",
|
||||
},
|
||||
description: `Condition Check Reminder Lambda infrastructure (${environment})`,
|
||||
tags: {
|
||||
Environment: environment,
|
||||
Project: "rentall",
|
||||
Service: "condition-check-reminder",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user