From 4a2e9320f2efc1ae402bf4f625fca0eb23e17f27 Mon Sep 17 00:00:00 2001 From: Nate Elliott Date: Thu, 12 Dec 2024 16:19:31 -0600 Subject: [PATCH] 10554: cleanup --- scripts/env/environments/00-common | 2 +- scripts/postgres/restoreDbFromSource.ts | 2 +- web-api/src/database.ts | 6 ++---- web-api/src/environment.ts | 3 ++- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/env/environments/00-common b/scripts/env/environments/00-common index 04ad0214011..a562a6e2b3f 100644 --- a/scripts/env/environments/00-common +++ b/scripts/env/environments/00-common @@ -5,7 +5,7 @@ REGION="${DEFAULT_REGION}" CURRENT_COLOR=$(./scripts/dynamo/get-current-color.sh "${ENV}") SOURCE_TABLE=$(./scripts/dynamo/get-source-table.sh "${ENV}") SOURCE_TABLE_VERSION="${SOURCE_TABLE//efcms-${ENV}-/}" -DB_HOST=$(./scripts/postgres/get-host.sh -h -w) # -w for writeable +DB_HOST=$(./scripts/postgres/get-host.sh -h -w) # region hard-coded; all ES domains and Cognito user pools are in us-east-1 ELASTICSEARCH_ENDPOINT=$(aws es describe-elasticsearch-domain \ diff --git a/scripts/postgres/restoreDbFromSource.ts b/scripts/postgres/restoreDbFromSource.ts index 83637f4b882..aa8cea65be5 100644 --- a/scripts/postgres/restoreDbFromSource.ts +++ b/scripts/postgres/restoreDbFromSource.ts @@ -81,7 +81,7 @@ async function main() { } void main(); -export async function describeRDSInstance({ +async function describeRDSInstance({ environment, rdsClient, useWriter = false, diff --git a/web-api/src/database.ts b/web-api/src/database.ts index 314aacdae23..e82418d026d 100644 --- a/web-api/src/database.ts +++ b/web-api/src/database.ts @@ -85,13 +85,11 @@ async function createConnection({ throw new Error('token does not exist'); } - const config = { + dbInstances[dbKey] = await connect({ ...POOL, host, password: token, - }; - - dbInstances[dbKey] = await connect(config); + }); return await cb(dbInstances[dbKey]!); } catch (err) { diff --git a/web-api/src/environment.ts b/web-api/src/environment.ts index eda77a29629..8523497bb14 100644 --- a/web-api/src/environment.ts +++ b/web-api/src/environment.ts @@ -37,7 +37,8 @@ export const environment = { user: process.env.POSTGRES_USER || 'postgres', }, readHost: process.env.POSTGRES_READ_HOST!, - useGlobalCert: true, + useGlobalCert: + process.env.NODE_ENV === 'production' || process.env.CIRCLE_BRANCH, }, region, s3Endpoint: isLocal