-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.js
94 lines (87 loc) · 3.68 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const config = require('nconf');
const path = require('path');
const fs = require('fs');
const log = require('log4js').getLogger('esdr:config');
const RunMode = require('run-mode');
const configFile = path.resolve(__dirname, './config-' + RunMode.get() + '.json');
const mailConfigFile = path.resolve(__dirname, './mail-config-' + RunMode.get() + '.json');
const ensureFileExists = function(file){
try {
fs.accessSync(file, fs.constants.R_OK);
}
catch (err) {
console.error("Config file [" + file + "] not found or not readable! Aborting. Error: " + err.message);
process.exit(1);
}
};
ensureFileExists(configFile);
ensureFileExists(mailConfigFile);
log.info("Using config file: " + configFile);
log.info("Using mail config file: " + mailConfigFile);
config.argv().env();
config.add('mail', { type : 'file', file : mailConfigFile });
config.add('global', { type : 'file', file : configFile });
config.defaults({
"server" : {
"port" : 3000
},
"esdr" : {
// the URL a client (e.g. web browser) must use to access the ESDR REST API
"apiRootUrl" : "http://localhost:3000/api/v1",
// the URL that the ESDR server must use to access itself for OAuth (should be localhost)
"oauthRootUrl" : "http://localhost:3000/oauth/token",
"numProcesses" : 2
},
"cookie" : {
"name" : "esdr_sid",
"secret" : "Thou art my heaven, and I thine eremite.",
"isSecure" : false
},
"esdrClient" : {
"displayName" : "ESDR",
"clientName" : "ESDR",
"clientSecret" : "What I cannot create, I do not understand.",
"email" : "[email protected]",
"resetPasswordUrl" : "http://localhost:3000/password-reset/:resetPasswordToken",
"verificationUrl" : "http://localhost:3000/verification/:verificationToken",
"isPublic" : true
},
"requestLogging" : {
"isEnabled" : false,
"logFile" : path.join(__dirname, './logs/access.log')
},
"resetPasswordToken" : {
"willReturnViaApi" : false,
"willEmailToUser" : true
},
"verificationToken" : {
"willReturnViaApi" : false,
"willEmailToUser" : true
},
"security" : {
"tokenLifeSecs" : 7 * 24 * 60 * 60 // 7 days
},
"database" : {
"host" : "localhost",
"port" : "3306",
"database" : "esdr",
"username" : "esdr",
"password" : "password",
"pool" : {
"connectionLimit" : 10
}
},
"datastore" : {
"binDirectory" : "./datastore/bin",
"dataDirectory" : "./datastore/data-dev"
},
"mail" : {
"smtp" : {
"host" : "smtp.host.name.here",
"port" : 587,
"login" : "login",
"password" : "password"
}
}
});
module.exports = config;