-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.js
More file actions
22 lines (21 loc) · 820 Bytes
/
config.js
File metadata and controls
22 lines (21 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//static data to don't have to generate the conf_adata 2 times
let config_data = null;
module.exports = function() {
// if the static data was already set. return it
if (config_data != null && config_data != undefined) {
return config_data
}
config_data = {}
//LOAD JSON
if (process.env.NODE_ENV === undefined || process.env.NODE_ENV == null || process.env.NODE_ENV == 'development') {
config_data = require('./config/config.development.json');
console.log("... development");
} else {
config_data = require('./config/config.production.json');
console.log("... production");
}
//LOAD FROM ENV VARIABLES
config_data.connection_string = process.env.connection_string;
config_data.port = process.env.port || config_data.port;
return config_data
}