Skip to content

Commit

Permalink
feat: ask for COUNTRY in setup environment (#276)
Browse files Browse the repository at this point in the history
* feat: ask for COUNTRY in setup environment

* feat: update country config
  • Loading branch information
naftis authored and Siyasanga committed Oct 16, 2024
1 parent 4891d8b commit 7fd15f2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

```
Expand Down
1 change: 1 addition & 0 deletions infrastructure/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker-compose.development-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker-compose.qa-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion infrastructure/environments/setup-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -754,6 +767,7 @@ ALL_QUESTIONS.push(
...sshQuestions,
...sshKeyQuestions,
...infrastructureQuestions,
...countryQuestions,
...databaseAndMonitoringQuestions,
...notificationTransportQuestions,
...smsQuestions,
Expand Down Expand Up @@ -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) || ''

Expand Down

0 comments on commit 7fd15f2

Please sign in to comment.