This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sample.js
78 lines (64 loc) · 1.74 KB
/
config.sample.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
'use strict';
var config = require('raintank-core/config').cnf();
/*-------------------------------------------------------
* Raintank Configuration File.
*
*--------------------------------------------------------*/
// remove objects from DB after 90days.
config.deleteTTL = 60*60*24*90;
config.adminToken = 'jk832sjksf9asdkvnngddfg8sfk';
config.mongoURL = 'mongodb://dbuser:dbpass@mongodb/raintank';
config.siteUrl = "http://proxy/";
config.defaultRole = '5314801a421408bcac0a6448';
config.emailFrom = "[email protected]";
config.graphite_api = {
host: 'graphite-api',
port: 8888
}
config.carbon = {
host: 'influxdb',
port: 2003
}
config.numCPUs = 1;
config.elasticSearch = {
host: 'elasticsearch:9200',
log: 'info'
};
config.queue = {
publisherSocketAddr: 'tcp://broker:9997',
consumerSocketAddr: "tcp://broker:9998",
partitions: 10,
mgmtUrl: "http://broker:9999"
};
config.port = 4000;
config.grafana_path = '/opt/grafana/src'; //Dev
//config.grafana_path = '/opt/raintank/grafana/current/dist'; //Production
/*-------------------------------------------------------*/
function parseEnv(name, value, cnf) {
if (name in cnf) {
cnf[name] = value;
return;
}
var parts = name.split('_');
var pos = 0
var found = false
while (!found && pos < parts.length) {
pos = pos + 1;
var group = parts.slice(0,pos).join('_');
if (group in cnf){
found = true;
parseEnv(parts.slice(pos).join('_'), value, cnf[group]);
}
}
if (!found) {
console.log("%s not found in config", name);
}
}
// overwrite with Environment variables
for (var key in process.env) {
if (key.indexOf('RAINTANK_') == 0) {
var name = key.slice(9);
parseEnv(name, process.env[key], config);
}
}
exports.config = config;