-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
48 lines (41 loc) · 1.13 KB
/
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
39
40
41
42
43
44
45
46
47
48
const nconf = require('nconf');
const defaultConfig = require('./config.json');
// to allow config overloading
// by a local config file
let localConf = {};
try {
// eslint-disable-next-line
localConf = require('./config.local.js');
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
}
nconf.argv()
.env([
'BBV_INDEX',
'BBV_JSFILE',
'BBV_LISTEN_ENRICHER_HOST',
'BBV_LISTEN_ENRICHER_PORT',
'BBV_LISTEN_HOST',
'BBV_LISTEN_PORT',
])
.overrides(localConf)
.defaults(defaultConfig);
let config = nconf.get();
config = Object.assign(config, {
index: config.BBV_INDEX || config.index,
jsfile: config.BBV_JSFILE || config.jsfile,
});
if (config.BBV_LISTEN_ENRICHER_HOST) {
config.listen['bibliomap-enricher'].host = config.BBV_LISTEN_ENRICHER_HOST;
}
if (config.BBV_LISTEN_ENRICHER_PORT) {
config.listen['bibliomap-enricher'].port = config.BBV_LISTEN_ENRICHER_PORT;
}
if (config.BBV_LISTEN_HOST) {
config.listen['bibliomap-viewer'].host = config.BBV_LISTEN_HOST;
}
if (config.BBV_LISTEN_PORT) {
config.listen['bibliomap-viewer'].port = config.BBV_LISTEN_PORT;
}
module.exports = config;