-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.js
50 lines (42 loc) · 911 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var R = require('ramda')
var defaultConfig = {
Neo4J: {
hostname: 'localhost',
port: 7474
},
batchTimeout: 1000,
batchSize: 2500,
// behave like a graph with equivalences
types: {
node: {
node: {}
},
arc: {
arc: {}
},
equivalence: {
equivalence: {}
}
}
}
function detectDockerLink () {
var addr = process.env.NEO4J_PORT_7474_TCP_ADDR
var port = process.env.NEO4J_PORT_7474_TCP_PORT
// found docker links, create and return config
if (addr && port) {
return {
Neo4J: {
hostname: addr,
port: port
}
}
}
}
module.exports = function (userConfig) {
// store configuration with user overrides
var conf = R.merge(defaultConfig, userConfig || {})
// detect docker links
var dockerConf = detectDockerLink()
// override user config with docker link config
return R.merge(conf, dockerConf)
}