From ce383732099682c39420e2cdf14cd179e7e65538 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Tue, 26 Nov 2024 10:56:20 -0500 Subject: [PATCH 1/2] fix: missing beacon network configuration + docs for env vars --- README.md | 15 ++++++++++++++- create_config_prod.js | 1 + src/public/config.js | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dcd0c252..d18aef91 100755 --- a/README.md +++ b/README.md @@ -8,6 +8,19 @@ it directly. ## Prerequisites: - Node Package Manager -## Translations in dev mode +## Development + +### Adding a new environment configuration variable + +Any new environment configuration variable must be registered in several places: + +* [`./create_config_prod.js`](./create_config_prod.js): mapping the environment variable to a config object entry for + production +* [`./webpack.config.js`](./webpack.config.js): setting a default value for Webpack building +* [`./src/public/config.js`](./src/public/config.js): creating the shape of the global config object +* [`./src/js/config.ts`](./src/js/config.ts): loading from the global config object (production) or from the environment + via Webpack (development) + +### Translations in dev mode Add your English to French translations in `dist/public/locales/fr/translation_fr.json` for them to appear on the website. diff --git a/create_config_prod.js b/create_config_prod.js index 57fdf8e8..c24b95f1 100644 --- a/create_config_prod.js +++ b/create_config_prod.js @@ -6,6 +6,7 @@ const siteConfig = { TRANSLATED: parseBoolean(process.env.BENTO_PUBLIC_TRANSLATED), BEACON_URL: process.env.BEACON_URL || null, BEACON_UI_ENABLED: parseBoolean(process.env.BENTO_BEACON_UI_ENABLED), + BEACON_NETWORK_ENABLED: parseBoolean(process.env.BENTO_BEACON_NETWORK_ENABLED), // Authentication PUBLIC_URL: process.env.BENTO_PUBLIC_URL || null, diff --git a/src/public/config.js b/src/public/config.js index 8e98a7ef..779177de 100644 --- a/src/public/config.js +++ b/src/public/config.js @@ -7,6 +7,7 @@ BENTO_PUBLIC_CONFIG = { TRANSLATED: null, BEACON_URL: null, BEACON_UI_ENABLED: null, + BEACON_NETWORK_ENABLED: null, // Authentication PUBLIC_URL: null, CLIENT_ID: null, From 6244248990960c6ae55dd47745e55ceb08545dc1 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Tue, 26 Nov 2024 10:59:12 -0500 Subject: [PATCH 2/2] docs: improve env var notes --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d18aef91..fee95e8d 100755 --- a/README.md +++ b/README.md @@ -12,14 +12,16 @@ it directly. ### Adding a new environment configuration variable -Any new environment configuration variable must be registered in several places: +Any new environment / configuration variable must be registered in several places: -* [`./create_config_prod.js`](./create_config_prod.js): mapping the environment variable to a config object entry for - production -* [`./webpack.config.js`](./webpack.config.js): setting a default value for Webpack building -* [`./src/public/config.js`](./src/public/config.js): creating the shape of the global config object -* [`./src/js/config.ts`](./src/js/config.ts): loading from the global config object (production) or from the environment - via Webpack (development) +1. [`./create_config_prod.js`](./create_config_prod.js): mapping the environment variable to a config object entry for + production. +2. [`./webpack.config.js`](./webpack.config.js): setting a default value for the environment variable; used in Webpack development + builds. +3. [`./src/public/config.js`](./src/public/config.js): creating the shape of the global config object (using the config object entry key, + mapped to in 1.) +4. [`./src/js/config.ts`](./src/js/config.ts): loading from the global config object (production) via key or from the + environment variable directly, through Webpack replacement (development). ### Translations in dev mode Add your English to French translations in `dist/public/locales/fr/translation_fr.json` for them to appear on the