forked from Colored-Coins/coloredcoinsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
33 lines (28 loc) · 882 Bytes
/
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
var log = require('loglevel')
var config = {
env: 'production',
testnet: false,
cexplorer: {
url: 'https://cexplorer.example.com',
},
logLevel: 'info',
port: 8080,
}
function moduleExists(name) {
try {
return require.resolve(name)
} catch (e) {
return false
}
}
var localConfig = { cexplorer: {} }
if (moduleExists('./config-local')) {
console.log('Loading a local configuration')
localConfig = require('./config-local')
}
config.env = process.env.NODE_ENV || localConfig.env || config.env
config.cexplorer.url = process.env.CEXPLORER_URL || localConfig.cexplorer.url || config.cexplorer.url
config.testnet = process.env.TESTNET || localConfig.testnet || config.testnet
config.logLevel = process.env.LOG_LEVEL || localConfig.logLevel || config.logLevel
config.port = process.env.PORT || localConfig.port || config.port
module.exports = config