Skip to content

Commit

Permalink
Allow DB_HOST to be configured from .env
Browse files Browse the repository at this point in the history
  • Loading branch information
wombolo committed Apr 2, 2019
1 parent a37be71 commit ca582e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
SECRET=SECRET
EMAILHOST=smtp.elasticemail.com
EMAILPORT=2525
EMAILUSER=email@andela.com
EMAILUSER=email@123.com
EMAILPASS=pass
DB_NAME=DB_DATABASE_NAME
DB_NAME_TEST=TEST_DB
DB_USER=DB_USERNAME
DB_PASSWORD=DB_PASSWORD
DB_HOST=127.0.0.1
DEFAULT_ARTICLE_IMAGE='https://images.pexels.com/photos/1047540/pexels-photo-1047540.jpeg?dl&fit=crop&crop=entropy&w=1280&h=853'
PORT=80
PASSWORD=12345
8 changes: 4 additions & 4 deletions src/db/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ const dotenv = require('dotenv');

dotenv.config();
const {
DB_USER, DB_NAME, DB_PASSWORD, DB_NAME_TEST
DB_USER, DB_NAME, DB_PASSWORD, DB_NAME_TEST, DB_HOST,
} = process.env;
module.exports = {
development: {
username: DB_USER,
password: DB_PASSWORD,
database: DB_NAME,
host: '127.0.0.1',
host: DB_HOST,
dialect: 'postgres'
},
test: {
username: DB_USER,
password: DB_PASSWORD,
database: DB_NAME_TEST,
host: '127.0.0.1',
host: DB_HOST,
dialect: 'postgres'
},
production: {
username: 'root',
password: null,
database: 'database_production',
host: '127.0.0.1',
host: DB_HOST,
dialect: 'postgres'
}
};

0 comments on commit ca582e7

Please sign in to comment.