File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ interface BackendStackProps extends cdk.StackProps {
1212 environment : string ;
1313 domainName ?: string ; // Optional domain name for certificate
1414 hostedZoneId ?: string ; // Optional hosted zone ID for domain
15+ cognitoClientId : string ;
16+ cognitoUserPoolId : string ;
1517}
1618
1719export class BackendStack extends cdk . Stack {
@@ -69,9 +71,7 @@ export class BackendStack extends cdk.Stack {
6971 } ) ;
7072
7173 // Look up existing Cognito User Pool
72- const userPoolId =
73- process . env . AWS_COGNITO_CLIENT_ID ||
74- cognito . UserPool . fromUserPoolId ( this , `${ appName } UserPool` , 'us-east-1_PszlvSmWc' ) . userPoolId ;
74+ const userPoolId = props . cognitoUserPoolId || cognito . UserPool . fromUserPoolId ( this , `${ appName } UserPool` , 'us-east-1_PszlvSmWc' ) . userPoolId ;
7575
7676 // Create a Cognito domain if it doesn't exist
7777 const userPoolDomain = cognito . UserPoolDomain . fromDomainName (
@@ -81,7 +81,7 @@ export class BackendStack extends cdk.Stack {
8181 ) ;
8282
8383 // Replace the userPoolClient reference with a direct reference to the client ID
84- const userPoolClientId = process . env . AWS_COGNITO_CLIENT_ID || 'default-client-id' ;
84+ const userPoolClientId = props . cognitoClientId ;
8585
8686 // Task Definition
8787 const taskDefinition = new ecs . FargateTaskDefinition (
Original file line number Diff line number Diff line change 22import 'source-map-support/register' ;
33import * as cdk from 'aws-cdk-lib' ;
44import { BackendStack } from './backend-stack' ;
5+ import * as dotenv from 'dotenv' ;
6+
7+ // Load environment variables from .env file
8+ dotenv . config ( ) ;
59
610export * from './backend-stack' ;
711
8- // This function can be called to create the stack
912export function main ( ) {
1013 const app = new cdk . App ( ) ;
1114
12- new BackendStack ( app , 'ai-medical-reports-backend-stack' , {
13- environment : 'development' ,
15+ console . log ( 'NODE_ENV' , process . env . NODE_ENV ) ;
16+ console . log ( 'AWS_COGNITO_CLIENT_ID' , process . env . AWS_COGNITO_CLIENT_ID ) ;
17+
18+ new BackendStack ( app , `ai-team-medical-reports-stack-${ process . env . NODE_ENV } ` , {
19+ environment : process . env . NODE_ENV || 'development' ,
1420 env : {
1521 account : process . env . CDK_DEFAULT_ACCOUNT ,
1622 region : process . env . CDK_DEFAULT_REGION || 'us-east-1' ,
1723 } ,
24+ cognitoClientId : process . env . AWS_COGNITO_CLIENT_ID ,
25+ cognitoUserPoolId : process . env . AWS_COGNITO_USER_POOL_ID ,
1826 } ) ;
1927
2028 return app ;
You can’t perform that action at this time.
0 commit comments