Skip to content

Commit

Permalink
Merge pull request #503 from kipr/navzam/update-readme-env-vars
Browse files Browse the repository at this point in the history
Update README with new env vars
  • Loading branch information
tcorbly authored Nov 13, 2024
2 parents afb655d + 08fe1c5 commit 6a6b8e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '<invalid>'),
domain: getEnvVarOrDefault('MAILGUN_DOMAIN', '<invalid>'),
},
};
},
Expand Down

0 comments on commit 6a6b8e4

Please sign in to comment.