-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use convict for configuration (#190)
* Move session secret to config * Move port to config * Move otpLifeSpan, bounceLifeSpan and submissionsTopUp to config * Move appConfig to config * Move formsgSdkMode to config * Move awsConfig to config * Move types out * Move cspReportUri and chromiumBin to config * Fix bugs with config loading * Move banners and custom watch grp to config * Move dbHost to config * Remove deprecated env vars * Move ses to convict and enforce that prod ses are defined * Remove repeated code to check bucket url * Reorganise banner env vars under banner key/header * Add missing env var to documentation and re-organise CSP_REPORT_URI' * Reorganise based on order in documentation * Move nodeEnv to convict * Move bucket urls to own convict that gets validated after * Move schemas to separate file * Fix format of nodeEnv * Edit nodemailer configuration to be based on environment * Reorganise and add comments * Remove convict config to Vars for clarity * Add types to convict schemas * Fix typing issues * Add documentation on FORMSG_LOCALSTACK_ENDPT * Reorganise for better readability * Fix bug with db host * Remove test env vars that no longer need to be unset * Use getProperties so that typing can be enforced * Remove warn validation on dev environment * Remove default for session secret * Add defaults for chromium bin * Add validation for db host * Split schemas into option, compulsory and prodOnly * Fix typing * Use new schemas and load dbUri based on environment * Update package * Remove env vars that don't need to be defined during tests * Move cspReportUri to sentry feature, enforce type url and only pass to Helmet if defined * Add missing documentation * Simplify logic * Remove otpGenerator * Define defaults directly in schema * Validate aws endpoint * Move defaults to constant file * Fix imports for constants file * Update default for bounceLifeSpan * Mark the relevant env vars as being sensitive * Add todo to clean up MyInfo env vars * Reference issue in todo * Move aws default endpoint to aws endpoint env var and enforce region in production urls * Fix rebase issues * Remove FORMSG_LOCALSTACK_ENDPT * Remove logger from config * Require config in logger now that config does not use logger * Remove aws region default * Use config.nodeEnv instead of process.env * Update docs/DEPLOYMENT_SETUP.md Co-authored-by: Antariksh Mahajan <[email protected]> * Update docs/DEPLOYMENT_SETUP.md Co-authored-by: Antariksh Mahajan <[email protected]> * Add AWS_ENDPOINT to docker file for dev purposes * Add comments to specify how convict defaults work * Add a session secret default for dev environment * Add default for aws endpoint in docker dev file Co-authored-by: Arshad Ali <[email protected]> Co-authored-by: Antariksh Mahajan <[email protected]>
- Loading branch information
1 parent
1bfb064
commit 68a9ea5
Showing
21 changed files
with
754 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/bin/bash | ||
set -x | ||
until $(curl --output /dev/null --silent --head --fail http://localhost:4572); do | ||
until $(curl --output /dev/null --silent --head --fail $AWS_ENDPOINT); do | ||
printf 'Waiting for Localstack to be ready...' | ||
sleep 5 | ||
done | ||
awslocal --endpoint-url=http://localhost:4572 s3 mb s3://$IMAGE_S3_BUCKET | ||
awslocal --endpoint-url=http://localhost:4572 s3 mb s3://$LOGO_S3_BUCKET | ||
awslocal --endpoint-url=http://localhost:4572 s3 mb s3://$ATTACHMENT_S3_BUCKET | ||
awslocal --endpoint-url=$AWS_ENDPOINT s3 mb s3://$IMAGE_S3_BUCKET | ||
awslocal --endpoint-url=$AWS_ENDPOINT s3 mb s3://$LOGO_S3_BUCKET | ||
awslocal --endpoint-url=$AWS_ENDPOINT s3 mb s3://$ATTACHMENT_S3_BUCKET | ||
set +x |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.