This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.js
62 lines (59 loc) · 1.48 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var convict = require('convict');
var conf = convict({
ip: {
doc: "The IP address to bind.",
format: "ipaddress",
default: "127.0.0.1",
env: "IP_ADDRESS"
},
port: {
doc: "The port to bind.",
format: "port",
default: 2345,
env: "PORT"
},
githubsecret: {
doc: "The secret half of your Github API key.",
default: "",
env: "GH_SECRET"
},
githubid: {
doc: "The client ID half of your Github API key.",
default:"ac164af2be0ddae99bce",
env: "GH_CLIENT"
},
repos: {
doc: "The default repositories to feature in the project list",
default:[
"visionmedia/jade",
"apenwarr/sshuttle",
"gitlabhq/gitlabhq",
"zuzak/apercu"
],
env: "REPOS",
format: Array
},
environ: {
doc: "The application environment",
format: ["dev", "test"],
default: "dev",
env: "NODE_ENV"
}
});
try {
conf.loadFile("./config.json");
console.log("Loaded config.json");
} catch(e){
// console.log("No config.json");
}
if(conf.get("environ") == "test"){
try {
console.log("*** TESTING ***");
conf.loadFile("./test/config.json");
console.log("Loaded test-specific config.json");
} catch(e) {
console.log("No test-specific config.json");
}
}
conf.validate();
module.exports = conf;