Skip to content

Commit

Permalink
Revert "revert(convict): "refactor: use convict for configuration (#190
Browse files Browse the repository at this point in the history
…)" (#285)"

This reverts commit 3e61aca.
  • Loading branch information
arshadali172 authored Sep 7, 2020
1 parent 3e61aca commit 6549ed6
Show file tree
Hide file tree
Showing 21 changed files with 1,725 additions and 623 deletions.
2 changes: 1 addition & 1 deletion .template-env
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AWS_ACCESS_KEY_ID=
FORMSG_SDK_MODE=


#### Optional variables, some have defaults defined here, as well as in `config/defaults`
#### Optional variables, some have defaults defined here, as well as in `config/schema`

## App Config
# APP_NAME=FormSG
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
- BOUNCE_LIFE_SPAN=1800000
- AWS_ACCESS_KEY_ID=fakeKey
- AWS_SECRET_ACCESS_KEY=fakeSecret
- SESSION_SECRET=thisisasecret
- GA_TRACKING_ID
- SENTRY_CONFIG_URL
- TWILIO_ACCOUNT_SID
Expand Down Expand Up @@ -63,6 +64,7 @@ services:
- IS_SP_MAINTENANCE
- IS_CP_MAINTENANCE
- AGGREGATE_COLLECTION
- AWS_ENDPOINT=http://localhost:4572

mockpass:
build: https://github.com/opengovsg/mockpass.git
Expand Down
39 changes: 26 additions & 13 deletions docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The following env variables are set in Travis:

### Core Features

#### App and Database
#### App Config

| Variable | Description |
| :----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -105,19 +105,27 @@ The following env variables are set in Travis:
| `APP_URL` | Defaults to `'https://form.gov.sg'`. |
| `APP_KEYWORDS` | Defaults to `'forms, formbuilder, nodejs'`. |
| `APP_IMAGES` | Defaults to `'/public/modules/core/img/og/img_metatag.png,/public/modules/core/img/og/logo-vertical-color.png'`. |
| `APP_TWITTER_IMAGE` | ath to Twitter image. Defaults to `'/public/modules/core/img/og/logo-vertical-color.png'`. |
| `APP_TWITTER_IMAGE` | Path to Twitter image. Defaults to `'/public/modules/core/img/og/logo-vertical-color.png'`. |

#### App and Database

| Variable | Description |
| :----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DB_HOST` | A MongoDB URI. |
| `OTP_LIFE_SPAN` | Time in milliseconds that admin login OTP is valid for. Defaults to 900000ms or 15 minutes. |
| `BOUNCE_LIFE_SPAN` | Time in milliseconds that bounces are tracked for each form. Defaults to 1800000ms or 30 minutes. Only relevant if you have set up AWS to send bounce and delivery notifications to the /emailnotifications endpoint. |
| `PORT` | Server port. Defaults to `5000`. |
| `NODE_ENV` | [Express environment mode](https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production). Defaults to `'development'`. This should always be set to a production environment |
| `SESSION_SECRET` | Secret for `express-session`. Defaults to `'sandcrawler-138577'`. This should always be set in a production environment. |
| `SUBMISSIONS_TOP_UP` | Use this to inflate the number of submissions displayed on the landing page. Defaults to `0`. |

#### Banners

| Variable | Description |
| :----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SITE_BANNER_CONTENT` | If set, displays a banner message on both private routes that `ADMIN_BANNER_CONTENT` covers **and** public form routes that `IS_GENERAL_MAINTENANCE` covers. Overrides all other banner environment variables |
| `ADMIN_BANNER_CONTENT` | If set, displays a banner message on private admin routes such as the form list page as well as form builder pages. |
| `IS_LOGIN_BANNER` | If set, displays a banner message on the login page |
| `IS_GENERAL_MAINTENANCE` | If set, displays a banner message on all forms. Overrides `IS_SP_MAINTENANCE` and `IS_CP_MAINTENANCE`. |
| `IS_SP_MAINTENANCE` | If set, displays a banner message on SingPass forms. Overrides `IS_CP_MAINTENANCE`. |
| `IS_CP_MAINTENANCE` | If set, displays a banner message on SingPass forms. |
| `SUBMISSIONS_TOP_UP` | Use this to inflate the number of submissions displayed on the landing page. Defaults to `0`. |

#### AWS services

Expand All @@ -126,6 +134,7 @@ The following env variables are set in Travis:
| `AWS_REGION` | AWS region. |
| `AWS_ACCESS_KEY_ID` | AWS IAM access key ID used to access S3. |
| `AWS_SECRET_ACCESS_KEY` | AWS IAM access secret used to access S3. |
| `AWS_ENDPOINT` | AWS S3 bucket endpoint. |
| `IMAGE_S3_BUCKET` | Name of S3 bucket for image field uploads. |
| `LOGO_S3_BUCKET` | Name of S3 bucket for form logo uploads. |
| `LOGO_S3_BUCKET` | Name of S3 bucket for form logo uploads. |
Expand All @@ -152,6 +161,7 @@ The following env variables are set in Travis:
| `MAIL_LOGGER` | If set to true then logs to console. If value is not set or is false then nothing is logged. |
| `MAIL_DEBUG` | If set to `true`, then logs SMTP traffic, otherwise logs only transaction events. |
| `CHROMIUM_BIN` | Filepath to chromium binary. Required for email autoreply PDF generation with Puppeteer. |
| `BOUNCE_LIFE_SPAN` | Time in milliseconds that bounces are tracked for each form. Defaults to 10800000ms or 3 hours. Only relevant if you have set up AWS to send bounce and delivery notifications to the /emailnotifications endpoint. |

### Additional Features

Expand Down Expand Up @@ -180,7 +190,8 @@ If this feature is enabled, client-side error events will be piped to [sentry.io

| Variable | Description |
| :------------------ | ----------------------------------------------------------------------------------------------------- |
| `SENTRY_CONFIG_URL` | Sentry.io URL for configuring the Sentry SDK. |
| `CSP_REPORT_URI` | Reporting URL for Content Security Policy violdations. Can be configured to use a Sentry.io endpoint. |
| `SENTRY_CONFIG_URL` | Sentry.io URL for configuring the Raven SDK. |
| `CSP_REPORT_URI` | Reporting URL for Content Security Policy violdations. Can be configured to use a Sentry.io endpoint. |

#### Examples page Using Pre-Computed Results
Expand Down Expand Up @@ -235,6 +246,8 @@ Note that MyInfo is currently not supported for storage mode forms and enabling
| `MYINFO_CLIENT_CONFIG` | Configures [MyInfoGovClient](https://github.com/opengovsg/myinfo-gov-client). Set this to either`stg` or `prod` to fetch MyInfo data from the corresponding endpoints. |
| `MYINFO_FORMSG_KEY_PATH` | Filepath to MyInfo private key, which is used to decrypt returned responses. |
| `MYINFO_APP_KEY` | (deprecated) Directly specify contents of the MyInfo FormSG private key. Only works if `NODE_ENV` is set to `development`. |
| `IS_SP_MAINTENANCE` | If set, displays a banner message on SingPass forms. Overrides `IS_CP_MAINTENANCE`. |
| `IS_CP_MAINTENANCE` | If set, displays a banner message on CorpPass forms. |

#### Verified Emails/SMSes

Expand All @@ -258,9 +271,9 @@ If this feature is enabled, storage mode forms will also support authentication

### Tests

| Variable | Description |
| :------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `MONGO_BINARY_VERSION` | Version of the Mongo binary used. Defaults to `'latest'` according to [MongoMemoryServer](https://github.com/nodkz/mongodb-memory-server) docs. |
| `PWD` | Path of working directory. |
| `MOCK_WEBHOOK_CONFIG_FILE` | Path of configuration file for mock webhook server |
| `MOCK_WEBHOOK_PORT` | Port of mock webhook server |
| Variable | Description |
| :--------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `MONGO_BINARY_VERSION` | Version of the Mongo binary used. Defaults to `'latest'` according to [MongoMemoryServer](https://github.com/nodkz/mongodb-memory-server) docs. |
| `PWD` | Path of working directory. |
| `MOCK_WEBHOOK_CONFIG_FILE` | Path of configuration file for mock webhook server |
| `MOCK_WEBHOOK_PORT` | Port of mock webhook server |
8 changes: 4 additions & 4 deletions init-localstack.sh
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
Loading

0 comments on commit 6549ed6

Please sign in to comment.