Skip to content

Commit

Permalink
Update config setup with overrides for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ealeksandrov committed Mar 1, 2018
1 parent 992eaa2 commit 1c39a51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
18 changes: 0 additions & 18 deletions docker.config.json
@@ -1,23 +1,5 @@
{
"port": 1337,
"security": {
"tokenLife" : 3600
},
"mongoose": {
"uri": "mongodb://mongo/apiDB"
},
"default": {
"api": {
"version" : "v1"
},
"user": {
"username": "myapi",
"password": "abc1234"
},
"client": {
"name": "Android API v1",
"clientId": "android",
"clientSecret": "SomeRandomCharsAndNumbers"
}
}
}
20 changes: 11 additions & 9 deletions libs/config.js
@@ -1,13 +1,15 @@
var nconf = require('nconf');

var config = (process.env.ENV_IN === 'docker') ?
'/docker.config.json' :
'/config.json';
nconf.argv().env();

nconf.argv()
.env()
.file({
file: process.cwd() + config
});
if (process.env.ENV_IN === 'docker') {
nconf.file('docker', {
file: process.cwd() + '/docker.config.json'
});
}

module.exports = nconf;
nconf.file('defaults', {
file: process.cwd() + '/config.json'
});

module.exports = nconf;

0 comments on commit 1c39a51

Please sign in to comment.