Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set database connection string #221

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following variables configure the use of a backend database to support user-

| Config Var | Env Var | Default | Notes |
| --- | --- | --- | --- |
| `connectionString` | `DB_CONNECTION_STRING` | coms | COMS database connection string, This setting has the highest priority to use. If not specified then connection details will be determined using the individual connection fields |
| `database` | `DB_DATABASE` | coms | COMS database name |
| `host` | `DB_HOST` | localhost | Database conection hostname |
| `username` | `DB_USERNAME` | app | Database account username |
Expand Down
1 change: 1 addition & 0 deletions app/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"username": "BASICAUTH_USERNAME"
},
"db": {
"connectionString": "DB_CONNECTION_STRING",
"database": "DB_DATABASE",
"host": "DB_HOST",
"password": "DB_PASSWORD",
Expand Down
3 changes: 3 additions & 0 deletions app/knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const logWrapper = (level, msg) => log.log(level, msg);
module.exports = {
client: 'pg',
connection: {
// connectionString is highest priority to use. If left unspecified then connection
// details will be determined using the individual connection fields (host, port, etc)
connectionString: config.has('db.connectionString') ? config.get('db.connectionString') : undefined,
host: config.get('db.host'),
user: config.get('db.username'),
password: config.get('db.password'),
Expand Down