From 695f0784587f4949e1796e0ac95d6fbc98f3c660 Mon Sep 17 00:00:00 2001 From: Nafis Zaman Date: Tue, 12 Nov 2024 17:20:55 -0800 Subject: [PATCH 1/2] Make mailgun vars optional for local dev --- config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 5814ee21..74e8c51d 100644 --- a/config.js +++ b/config.js @@ -41,8 +41,9 @@ module.exports = { serviceAccountKey, }, mailgun: { - apiKey: getEnvVarOrDefault('MAILGUN_API_KEY', ''), - domain: getEnvVarOrDefault('MAILGUN_DOMAIN', ''), + // Provide defaults so mailgun client can be created even if not configured during local development + apiKey: getEnvVarOrDefault('MAILGUN_API_KEY', ''), + domain: getEnvVarOrDefault('MAILGUN_DOMAIN', ''), }, }; }, From 08fe1c53ae33dd3fce055c8c9ce0749e23a8d845 Mon Sep 17 00:00:00 2001 From: Nafis Zaman Date: Tue, 12 Nov 2024 17:21:06 -0800 Subject: [PATCH 2/2] Update README with new env vars --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b5337a28..2b6a9fc8 100644 --- a/README.md +++ b/README.md @@ -145,16 +145,22 @@ In another terminal, run the server: node express.js ``` -## Configuration +See [Configuration](#configuration) for environment variables. The server will not run unless the required environment variables are set. -The server can be configured using environment variables. Variables without default values must be provided. +## Configuration -| Variable | Description | Default value | -| -------- | ----------- | ------------- | -| `SERVER_PORT` | The port on which to listen for requests | `3000` | -| `CACHING_STATIC_MAX_AGE` | The max duration (in ms) to allow static assets to be cached | `3600000` (1 hr) | -| `FEEDBACK_WEBHOOK_URL` | The url for the discord webhook to send feedback to | | -| `API_URL` | The url for the KIPR database server | `https://db-prerelease.botballacademy.org` | +The server can be configured using environment variables. Some variables are required. + +| Variable | Description | Default value | Required | +| -------- | ----------- | ------------- | -------- | +| `SERVER_PORT` | The port on which to listen for requests | `3000` | no | +| `CACHING_STATIC_MAX_AGE` | The max duration (in ms) to allow static assets to be cached | `3600000` (1 hr) | no | +| `FEEDBACK_WEBHOOK_URL` | The url for the discord webhook to send feedback to | | no | +| `API_URL` | The url for the KIPR database server | `https://db-prerelease.botballacademy.org` | no | +| `FIREBASE_SERVICE_ACCOUNT_KEY_FILE` | Firebase service account key JSON (as a file path). Only used if `FIREBASE_SERVICE_ACCOUNT_KEY_STRING` is not present | | yes* | +| `FIREBASE_SERVICE_ACCOUNT_KEY_STRING` | Firebase service account key JSON (as a string) | | yes* | +| `MAILGUN_API_KEY` | API key for Mailgun service | | no | +| `MAILGUN_DOMAIN` | Domain used for Mailgun emails | | no | ## Using a local `database` service