From 8d0d9a01f1b66325b9ae02ed33eb23e8d9ffc0c1 Mon Sep 17 00:00:00 2001 From: Yousan_O Date: Mon, 10 Jun 2024 17:02:06 +0900 Subject: [PATCH 1/2] Add development DB connection info --- lib/decidim-stack.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/decidim-stack.ts b/lib/decidim-stack.ts index ed9e08d..f5d4e5f 100644 --- a/lib/decidim-stack.ts +++ b/lib/decidim-stack.ts @@ -119,6 +119,11 @@ export class DecidimStack extends cdk.Stack { RDS_HOSTNAME: props.rds, RDS_USERNAME: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/RDS_USERNAME`), RDS_PASSWORD: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/RDS_PASSWORD`), + // 以下は decidim リポジトリにあるdatabase.yaml の default で取得されている環境変数名。 + DATABASE_HOST: props.rds, + // DATABASE_PORT: '5432', + DATABASE_USERNAME: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/RDS_USERNAME`), + DATABASE_PASSWORD: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/RDS_PASSWORD`), SECRET_KEY_BASE: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/SECRET_KEY_BASE`), SMTP_ADDRESS: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/SMTP_ADDRESS`), SMTP_USERNAME: ssm.StringParameter.valueForTypedStringParameterV2(this, `/decidim-cfj/${ props.stage }/SMTP_USERNAME`), From f64b59f0d4834e93effbadfcc7d5fb624c784dd2 Mon Sep 17 00:00:00 2001 From: Yousan_O Date: Mon, 10 Jun 2024 17:56:42 +0900 Subject: [PATCH 2/2] refactor: Update test snapshot with `npm run test -- -u` --- .../decidim-cfj-cdk.test.ts.snap | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/__snapshots__/decidim-cfj-cdk.test.ts.snap b/test/__snapshots__/decidim-cfj-cdk.test.ts.snap index f22f542..2a2d850 100644 --- a/test/__snapshots__/decidim-cfj-cdk.test.ts.snap +++ b/test/__snapshots__/decidim-cfj-cdk.test.ts.snap @@ -1199,6 +1199,24 @@ exports[`DecidimStack Created 1`] = ` "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", }, }, + { + "Name": "DATABASE_HOST", + "Value": { + "Fn::ImportValue": "stagingdecidimRdsStack:ExportsOutputFnGetAttcreateRds829C4ED0EndpointAddressA146A595", + }, + }, + { + "Name": "DATABASE_USERNAME", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSUSERNAMEC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, + { + "Name": "DATABASE_PASSWORD", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, { "Name": "SECRET_KEY_BASE", "Value": { @@ -1396,6 +1414,24 @@ exports[`DecidimStack Created 1`] = ` "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", }, }, + { + "Name": "DATABASE_HOST", + "Value": { + "Fn::ImportValue": "stagingdecidimRdsStack:ExportsOutputFnGetAttcreateRds829C4ED0EndpointAddressA146A595", + }, + }, + { + "Name": "DATABASE_USERNAME", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSUSERNAMEC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, + { + "Name": "DATABASE_PASSWORD", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, { "Name": "SECRET_KEY_BASE", "Value": { @@ -1956,6 +1992,24 @@ exports[`DecidimStack Created 1`] = ` "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", }, }, + { + "Name": "DATABASE_HOST", + "Value": { + "Fn::ImportValue": "stagingdecidimRdsStack:ExportsOutputFnGetAttcreateRds829C4ED0EndpointAddressA146A595", + }, + }, + { + "Name": "DATABASE_USERNAME", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSUSERNAMEC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, + { + "Name": "DATABASE_PASSWORD", + "Value": { + "Ref": "SsmParameterValuedecidimcfjstagingRDSPASSWORDC96584B6F00A464EAD1953AFF4B05118Parameter", + }, + }, { "Name": "SECRET_KEY_BASE", "Value": {