From e591b1879af127b75895491e9be0e44f618fe963 Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Mon, 25 Mar 2024 15:11:33 +0000 Subject: [PATCH 1/3] Re-organise env variables alphabetically and add missing env variables from docker-compose (FEATURE_FLAG_ENABLE_AUTH, GITHUB_KEY, SESSION_APP_KEY, SESSION_ID_NAME) --- README.md | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6afadb9..b3d2adb 100644 --- a/README.md +++ b/README.md @@ -26,27 +26,32 @@ The issue is then reviewed by the team, and further comments may be requested if ### Config variables -Key | Description | Example Value -----------------|--------------------------- |------------------------- -PATH_SSL_PRIVATE_KEY | Path to ssl private key | `./infrastructure/host/test.key` -PATH_SSL_CERTIFICATE | Path to ssl certificate | `./infrastructure/host/test.cert` -BASE_URL | Base application URL | `http://localhost:3000` (dev mode) -NODE_ENV | Node environment | `development` (or `production`) -PORT | Server port number | `3000` -CDN_HOST | CDN host | `cdn domain` -USER_POOL_ID | ID of the user pool in Amazon Cognito | `secret` -USER_POOL_CLIENT_ID | Client ID of an app registered with the user pool in Amazon Cognito | `secret` -AUTH_SIGN_IN_URL | Authentication sign in URL | `https://cola.service.cabinetoffice.gov.uk/v2//login` -COOKIE_ID_NAME | The name of the cookie | `github-requests` -COOKIE_PARSER_SECRET | Secret used in validating/calculating the cookie signature | `secret` -COOKIE_SESSION_SECRET | Secret key for signing the session cookie | `secret` -LANDING_PAGE_URL | Github Requests landing Page | `/home/` -GITHUB_OWNER | Github organization name | `cabinetoffice` -GITHUB_TERRAFORM_REPO | Github private repo with terraform configurations with members, repos and teams files | `github-requests-terraform` -GITHUB_REPO_ISSUE_ASSIGNEE | Github team responsible to solve issues and update configs files | (eg. `IDP_TEAM`) -GITHUB_REPO_ISSUE_LABEL | Github label to categorize the related issues | (eg. `github-requests-app`) -LOG_LEVEL | Logging levels | `info` -HUMAN | Formatting messages form (default JSON) | `true` (Enable human formatting for log messages) +| Key | Description | Example Value | +|-----------------------------|---------------------------------------------------------------------|---------------------------------------------------------- | +| AUTH_SIGN_IN_URL | Authentication sign in URL | `https://cola.service.cabinetoffice.gov.uk/v2//login`| +| BASE_URL | Base application URL | `http://localhost:3000` (dev mode) | +| CDN_HOST | CDN host | `cdn_domain` | +| COOKIE_ID_NAME | The name of the cookie | `github-requests` | +| COOKIE_PARSER_SECRET | Secret used in validating/calculating the cookie signature | `secret` | +| COOKIE_SESSION_SECRET | Secret key for signing the session cookie | `secret` | +| FEATURE_FLAG_ENABLE_AUTH | Enable authentication feature flag | `true` or `false` | +| GITHUB_KEY | GitHub key | `[github key]` | +| GITHUB_OWNER | GitHub organisation name | `cabinetoffice` | +| GITHUB_REPO_ISSUE_ASSIGNEE | GitHub team responsible to solve issues and update configs files | `IDP_TEAM` | +| GITHUB_REPO_ISSUE_LABEL | GitHub label to categorize the related issues | `github-requests-app` | +| GITHUB_TERRAFORM_REPO | GitHub private repo with terraform configurations with members, repos and teams files | `github-requests-terraform` | +| HUMAN | Formatting messages form (default JSON) | `true` (Enable human formatting for log messages) | +| LOG_LEVEL | Logging levels | `info` | +| NODE_ENV | Node environment | `development` or `production` | +| NODE_SSL_ENABLED | Whether SSL is enabled for Node | `true` or `false` | +| PATH_SSL_CERTIFICATE | Path to SSL certificate | `./infrastructure/host/test.cert` | +| PATH_SSL_PRIVATE_KEY | Path to SSL private key | `./infrastructure/host/test.key` | +| PORT | Server port number | `3000` | +| SESSION_APP_KEY | Session application key | `git` | +| SESSION_ID_NAME | Session ID name | `connect.sid` | +| USER_POOL_CLIENT_ID | Client ID of an app registered with the user pool in Amazon Cognito | `secret` | +| USER_POOL_ID | ID of the user pool in Amazon Cognito | `secret` | + ## Launching the web-app From 7c80d0e0f5c1fd4c8a2ca65d40cf5d43901e7f39 Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Mon, 25 Mar 2024 15:13:13 +0000 Subject: [PATCH 2/3] update local development instructions to explain the need for CDN_HOST and to build the application --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b3d2adb..0a83fea 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,23 @@ The issue is then reviewed by the team, and further comments may be requested if ### Running local development environment with Docker -Docker is used to run the application in **development** mode, with tooling setup to detect changes in local `src` directory and reload the container's node server. Ensure that `NODE_ENV=development` is set in the `.env` file. +Docker is used to run the application in **development** mode, with tooling setup to detect changes in local `src` directory and reload the container's node server. + +- Ensure that `NODE_ENV=development` is set in the `.env` file. + +- In order for static assets to be loaded, the `CDN_HOST` must be set to a CDN domain which serves the GOV.UK static assets. + +### Building the application + +To build the project, run: + +```sh +make build +``` ### Building the Docker Image -1. Create a copy of the `.env.example` file and name it `.env`: -Then run: +Create a copy of the `.env.example` file and name it `.env`, then run: ```sh make docker-build From 1a8f91a91ab138500e619ab02fe61134bed123ad Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Mon, 25 Mar 2024 15:15:02 +0000 Subject: [PATCH 3/3] add missing GITHUB_KEY env variable to .env.example and update its format to be consistent with docker-compose.yml and README.md files --- .env.example | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/.env.example b/.env.example index 756fd50..1c6147e 100644 --- a/.env.example +++ b/.env.example @@ -1,33 +1,23 @@ -PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.key" -PATH_SSL_CERTIFICATE="./infrastructure/host/test.cert" - -PORT=3000 -NODE_ENV=development - +AUTH_SIGN_IN_URL="https://cola.service.cabinetoffice.gov.uk/v2//login" BASE_URL="http://localhost:3000" CDN_HOST="test" -NODE_SSL_ENABLED="false" - +COOKIE_ID_NAME="github-requests" COOKIE_PARSER_SECRET="test" COOKIE_SESSION_SECRET="test" - -AUTH_SIGN_IN_URL="https://cola.service.cabinetoffice.gov.uk/v2//login" - -USER_POOL_ID="test" -USER_POOL_CLIENT_ID="test" - -COOKIE_ID_NAME="test" -SESSION_ID_NAME="test" -SESSION_APP_KEY="test" - +FEATURE_FLAG_ENABLE_AUTH="true" +GITHUB_KEY="test" GITHUB_OWNER="test" -GITHUB_TERRAFORM_REPO="test" GITHUB_REPO_ISSUE_ASSIGNEE="test" GITHUB_REPO_ISSUE_LABEL="test" - -LOG_LEVEL=info -HUMAN=true - -# Feature Flags - -FEATURE_FLAG_ENABLE_AUTH="false" \ No newline at end of file +GITHUB_TERRAFORM_REPO="test" +HUMAN="true" +LOG_LEVEL="info" +NODE_ENV="development" +NODE_SSL_ENABLED="false" +PATH_SSL_CERTIFICATE="./infrastructure/host/test.key" +PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.cert" +PORT=3000 +SESSION_APP_KEY="git" +SESSION_ID_NAME="connect.sid" +USER_POOL_CLIENT_ID="test" +USER_POOL_ID="test" \ No newline at end of file