-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
38 lines (33 loc) · 919 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require('dotenv').config();
const env = process.env.NODE_ENV; // 'dev' or 'prod'
const dev = {
app: {
port: parseInt(process.env.DEV_APP_PORT, 10) || 3030,
secret: process.env.SECRET || 'helloWorld',
},
db: {
host: process.env.DEV_DB_HOST || 'localhost',
port: parseInt(process.env.DEV_DB_PORT, 10) || 5432,
database: process.env.DEV_DB_NAME || 'saltydog1',
user: process.env.PGUSER,
password: process.env.PG_PASSWORD,
},
};
const prod = {
app: {
port: parseInt(process.env.PROD_APP_PORT, 10) || 3030,
secret: process.env.SECRET || 'helloWorld',
},
db: {
host: process.env.PROD_DB_HOST || 'database',
port: parseInt(process.env.TEST_DB_PORT, 10) || 5432,
database: process.env.TEST_DB_NAME || 'saltydog1',
user: process.env.PGUSER,
password: process.env.PG_AWS_PASSWORD,
},
};
const config = {
dev,
prod,
};
module.exports = config[env];