Skip to content

Commit 600c7d9

Browse files
committed
make db migration configurable
1 parent 4fa94f5 commit 600c7d9

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ The following parameters can be set in config files or in env variables:
7373

7474
Configuration for migration is at `./config/config.json`.
7575

76+
The following parameters can be set in the config file or via env variables:
77+
78+
- `username`: set via env `DB_USERNAME`; datebase username
79+
- `password`: set via env `DB_PASSWORD`; datebase password
80+
- `database`: set via env `DB_NAME`; datebase name
81+
- `host`: set via env `DB_HOST`; datebase host name
82+
7683
## ElasticSearch Setup
7784
- Go to https://www.elastic.co/downloads/ download and install the elasticsearch.
7885
- Modify `esConfig` under `config/default.js` to meet your environment.

config/config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Configuration for DB migration.
3+
*/
4+
5+
module.exports = {
6+
development: {
7+
username: process.env.DB_USERNAME || 'postgres',
8+
password: process.env.DB_PASSWORD || 'postgres',
9+
database: process.env.DB_NAME || 'postgres',
10+
host: process.env.DB_HOST || '127.0.0.1',
11+
dialect: 'postgres'
12+
},
13+
test: {
14+
username: process.env.DB_USERNAME || 'postgres',
15+
password: process.env.DB_PASSWORD || 'postgres',
16+
database: process.env.DB_NAME || 'postgres',
17+
host: process.env.DB_HOST || '127.0.0.1',
18+
dialect: 'postgres'
19+
},
20+
production: {
21+
username: process.env.DB_USERNAME,
22+
password: process.env.DB_PASSWORD,
23+
database: process.env.DB_NAME,
24+
host: process.env.DB_HOST,
25+
dialect: 'postgres'
26+
}
27+
}

0 commit comments

Comments
 (0)