0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Add config items

Add config items and default values:
- web_port (8001)
- environment (local)
This commit is contained in:
G.Ambatte
2020-12-06 20:39:43 +13:00
parent 4ee891a3ba
commit 8887961d09
2 changed files with 7 additions and 1 deletions

View File

@@ -2,5 +2,6 @@
"host" : "homebrewery.local.naturalcrit.com:8000",
"naturalcrit_url" : "local.naturalcrit.com:8010",
"secret" : "secret",
"web_port" : 8000
"web_port" : 8001,
"environment" : "local"
}

View File

@@ -27,6 +27,11 @@ const config = require('nconf')
.file('environment', { file: `config/${process.env.NODE_ENV}.json` })
.file('defaults', { file: 'config/default.json' });
if ( !process.env.NODE_ENV && config.get('environment') ) {
process.env.NODE_ENV = config.get('environment');
console.log('NODE_ENV set from config')
}
//DB
const mongoose = require('mongoose');
mongoose.connect(config.get('mongodb_uri') || config.get('mongolab_uri') || 'mongodb://localhost/naturalcrit',