From 7fd15f27ab0661aa4855b3ce345f1a8f71c71a52 Mon Sep 17 00:00:00 2001 From: Pyry Rouvila Date: Tue, 24 Sep 2024 14:23:19 +0300 Subject: [PATCH] feat: ask for COUNTRY in setup environment (#276) * feat: ask for COUNTRY in setup environment * feat: update country config --- CHANGELOG.md | 2 +- infrastructure/docker-compose.deploy.yml | 1 + .../docker-compose.development-deploy.yml | 2 +- infrastructure/docker-compose.qa-deploy.yml | 2 +- .../environments/setup-environment.ts | 17 ++++++++++++++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 565c7e6b1..91d59a129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Improvements - Auth token, ip address, remote address, mobile number, email redacted/masked from server log +- Country alpha3 ISO code now is derived from variables to the Docker Compose files and don't need to be hard coded ### Infrastructure breaking changes @@ -105,7 +106,6 @@ INSERT CSV ROWS IN ENGLISH ONLY - **`/record-notification` API**: Endpoint to check enabled notifications for records. The API returns the `notificationForRecord` object for `BIRTH` and `DEATH` events, listing their respective flags. Route configuration includes description and tags for API documentation. - ### New content keys requiring translation ``` diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index b0ecc9dff..f9f941e5a 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -704,6 +704,7 @@ services: - LOGIN_URL=https://login.{{hostname}} - CLIENT_APP_URL=https://register.{{hostname}} - DOMAIN={{hostname}} + - COUNTRY=${COUNTRY} deploy: labels: - 'traefik.enable=true' diff --git a/infrastructure/docker-compose.development-deploy.yml b/infrastructure/docker-compose.development-deploy.yml index 4910514f3..00f67cf91 100644 --- a/infrastructure/docker-compose.development-deploy.yml +++ b/infrastructure/docker-compose.development-deploy.yml @@ -37,7 +37,7 @@ services: environment: - LANGUAGES=en,fr - SENTRY_DSN=${SENTRY_DSN:-} - - COUNTRY=FAR + - COUNTRY=${COUNTRY} - QA_ENV=true - NODE_ENV=production - DISABLE_RATE_LIMIT=true diff --git a/infrastructure/docker-compose.qa-deploy.yml b/infrastructure/docker-compose.qa-deploy.yml index 73d7b97f5..f6d4a8173 100644 --- a/infrastructure/docker-compose.qa-deploy.yml +++ b/infrastructure/docker-compose.qa-deploy.yml @@ -66,7 +66,7 @@ services: environment: - LANGUAGES=en,fr - SENTRY_DSN=${SENTRY_DSN:-} - - COUNTRY=FAR + - COUNTRY=${COUNTRY} - QA_ENV=true - NODE_ENV=production - DISABLE_RATE_LIMIT=true diff --git a/infrastructure/environments/setup-environment.ts b/infrastructure/environments/setup-environment.ts index dc3cc84d7..66dbc41f5 100644 --- a/infrastructure/environments/setup-environment.ts +++ b/infrastructure/environments/setup-environment.ts @@ -329,7 +329,7 @@ const sshQuestions = [ name: 'sshHost', type: 'text' as const, message: - 'What is the target server IP address? (Note: For "production" environment with 2, 3 or 5 servers, this is the IP address of the manager server', + 'What is the target server IP address? (Note: For "production" environment with 2, 3 or 5 servers, this is the IP address of the manager server)', valueType: 'VARIABLE' as const, validate: notEmpty, valueLabel: 'SSH_HOST', @@ -373,6 +373,19 @@ const sshKeyQuestions = [ } ] +const countryQuestions = [ + { + name: 'country', + type: 'text' as const, + message: + 'What is the ISO 3166-1 alpha-3 country-code? (e.g. "NZL" for New Zealand) Reference: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3', + valueType: 'VARIABLE' as const, + valueLabel: 'COUNTRY', + initial: process.env.COUNTRY, + scope: 'REPOSITORY' as const + } +] + const infrastructureQuestions = [ { name: 'diskSpace', @@ -754,6 +767,7 @@ ALL_QUESTIONS.push( ...sshQuestions, ...sshKeyQuestions, ...infrastructureQuestions, + ...countryQuestions, ...databaseAndMonitoringQuestions, ...notificationTransportQuestions, ...smsQuestions, @@ -1026,6 +1040,7 @@ const SPECIAL_NON_APPLICATION_ENVIRONMENTS = ['jump', 'backup'] const answerOrExisting = ( variable: string | undefined, existingValue: Variable | undefined, + // eslint-disable-next-line no-unused-vars fn: (value: string | undefined) => string ) => fn(variable || existingValue?.value) || ''