From 4adc8aa2772cbedc4c7dffe1686c6c8e57565278 Mon Sep 17 00:00:00 2001 From: Pete Dunlap Date: Mon, 3 Feb 2025 13:44:36 -0500 Subject: [PATCH] CMDCT-4184 - cleans up env variables during import naming --- deployment/app.ts | 4 ++-- deployment/import_instructions.md | 6 +++--- src/write-ui-env-file.ts | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/deployment/app.ts b/deployment/app.ts index 2f654f84f..1403e1d0e 100644 --- a/deployment/app.ts +++ b/deployment/app.ts @@ -42,9 +42,9 @@ async function main() { cdk.Tags.of(app).add("PROJECT", config.project); let correctParentStack; - if (process.env.WITHOUT_IMPORTS) { + if (process.env.IMPORT_VARIANT == "empty") { correctParentStack = WithoutImportsParentStack - } else if (process.env.WITH_IMPORTS) { + } else if (process.env.IMPORT_VARIANT == "imports_included") { correctParentStack = WithImportsParentStack } else { correctParentStack = ParentStack diff --git a/deployment/import_instructions.md b/deployment/import_instructions.md index 61f1ffc03..0134d5ce4 100644 --- a/deployment/import_instructions.md +++ b/deployment/import_instructions.md @@ -29,20 +29,20 @@ cognito.UserPool - 1. Create just the new cdk stack without anything inside of it. ```bash -WITHOUT_IMPORTS=true ./run deploy --stage +IMPORT_VARIANT=empty ./run deploy --stage ``` 2. Now import all the serverless ejected resources. ```bash -WITH_IMPORTS=true PROJECT=seds cdk import --context stage= --force +IMPORT_VARIANT=imports_included PROJECT=seds cdk import --context stage= --force ``` As this import occurs you'll have to provide the information you gathered just before destroying the serverless stacks. For the dynamo tables the default should be correct but read closely to be sure. 3. Run a deploy on that same imported resource set. ```bash -WITH_IMPORTS=true ./run deploy --stage +IMPORT_VARIANT=imports_included ./run deploy --stage ``` 4. Run a full deploy by kicking off the full cdk deploy. diff --git a/src/write-ui-env-file.ts b/src/write-ui-env-file.ts index 84c075c4d..7e3e26780 100644 --- a/src/write-ui-env-file.ts +++ b/src/write-ui-env-file.ts @@ -26,11 +26,15 @@ export async function writeUiEnvFile(stage: string, local = false) { } const deploymentOutput = JSON.parse(Parameter!.Value!); + let api_url = deploymentOutput.apiGatewayRestApiUrl; + if (!local) { + api_url = api_url.slice(0, -1) + } const envVariables = { LOCAL_LOGIN: "false", SKIP_PREFLIGHT_CHECK: "true", API_REGION: region, - API_URL: deploymentOutput.apiGatewayRestApiUrl, + API_URL: api_url, COGNITO_REGION: region, COGNITO_IDENTITY_POOL_ID: deploymentOutput.identityPoolId, COGNITO_USER_POOL_ID: deploymentOutput.userPoolId,