Skip to content

Commit

Permalink
Update export string generation
Browse files Browse the repository at this point in the history
Signed-off-by: Tanner Lewis <[email protected]>
  • Loading branch information
lewijacn committed Nov 7, 2024
1 parent 62fd402 commit 1e0be25
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion deployment/migration-assistant-solution/lib/solutions-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ function importVPC(stack: Stack, vpdIdParameter: CfnParameter, availabilityZones
});
}

function generateExportString(exports: { [key: string]: string }): string {

Check failure on line 92 in deployment/migration-assistant-solution/lib/solutions-stack.ts

View workflow job for this annotation

GitHub Actions / node-tests (./deployment/migration-assistant-solution)

A record is preferred over an index signature
return Object.entries(exports)
.map(([key, value]) => `export ${key}=${value}`)
.join("; ");
}

export class SolutionsInfrastructureStack extends Stack {

constructor(scope: Construct, id: string, props: SolutionsInfrastructureStackProps) {
Expand Down Expand Up @@ -182,8 +188,14 @@ export class SolutionsInfrastructureStack extends Stack {
vpc = importVPC(this, vpcIdParameter, availabilityZonesParameter, privateSubnetIdsParameter);
}

const exportString = generateExportString({
"MIGRATIONS_APP_REGISTRY_ARN": appRegistryAppARN,
"MIGRATIONS_USER_AGENT": solutionsUserAgent,
"VPC_ID": vpc.vpcId,
"STAGE": stageParameter.valueAsString,
})
const cfnInitConfig: InitElement[] = [
InitCommand.shellCommand(`echo "export MIGRATIONS_APP_REGISTRY_ARN=${appRegistryAppARN}; export MIGRATIONS_USER_AGENT=${solutionsUserAgent}; export VPC_ID=${vpc.vpcId}; export STAGE=${stageParameter.valueAsString}" > /etc/profile.d/solutionsEnv.sh`),
InitCommand.shellCommand(`echo "${exportString}" > /etc/profile.d/solutionsEnv.sh`),
InitFile.fromFileInline("/opensearch-migrations/initBootstrap.sh", './initBootstrap.sh', {
mode: "000744"
}),
Expand Down

0 comments on commit 1e0be25

Please sign in to comment.