This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
config-dev.js
109 lines (103 loc) · 3.18 KB
/
config-dev.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Server side application configuration
var config = {
// Application port number
"port": process.env.PORT || process.env.FH_PORT || 8001,
"morganFormat": "dev",
"logStackTraces": true,
// Use this parameter to disable inserting demo data into mongodb
"seedDemoData": true,
// General security configuration
"security": {
"adminRole": "admin",
"userRole": "user",
// Passport.js security configuration
"passportjs": {
// Passport.js secret for JWT tokens. Provide custom value even for development needs
"jwtSecret": "D837131FD17F62CB85FBD5919563086369691F4D42379C3596F811839A8992CBA1FBA88DF243BF2481940F112D339C33283BDFEF29A13612550EDAAAB7B5E061",
// Allows to provide custom login page messages
"portalLoginPage": {
"title": "RainCatcher Portal",
"invalidMessage": "Invalid Credentials"
},
},
/// Redis session store configuration
// https://github.com/tj/connect-redis
"redisStore": {
"host": getRedisHost(),
"port": getRedisPort(),
"prefix": "rcsession:",
"logErrors": true
},
// Configuration for express session (used for both passport and keycloak)
// https://github.com/expressjs/session
"session": {
// Generate new secret for production use
"secret": process.env.SESSION_SECRET || 'a0dc2c73a1808f65029f41e1b87abf47be4b226b061dd2c025eae3f981ef243444',
"resave": false,
"saveUninitialized": true,
"cookie": {
"secure": false,
"httpOnly": true,
"path": '/'
}
},
// Keycloak configuration. Fill in details to enable keycloak
"keycloak": {
"realm": "",
"bearer-only": true,
"auth-server-url": "",
"ssl-required": "external",
"resource": "",
"use-resource-role-mappings": true
}
},
"sync": {
// Required to handle UI.
"customDataHandlers": true,
/**
* Specify that completed WorkOrders over a given number of days must be excluded from listings
* sent to mobile clients. Use -1 to deactivate this feature
*
* Only works if {@link customDataHandlers} is true
*/
"daysToExcludeCompleteWorkorders": 2
},
// See bunyan.d.ts/LoggerOptions
"bunyanConfig": {
"name": "Demo application",
"level": "debug"
},
// Database configuration
"mongodb": {
"url": getMongoUrl(),
"options": {}
},
// Cache layer configuration
"redis": {
"url": getRedisUrl()
},
}
function getMongoUrl() {
if (process.env.MONGO_CONNECTION_URL) {
return process.env.MONGO_CONNECTION_URL
}
if (process.env.FH_MONGODB_CONN_URL) {
// Legacy env variable only to support in house systems
return process.env.FH_MONGODB_CONN_URL;
}
return "mongodb://127.0.0.1:27017/raincatcher";
}
function getRedisPort() {
if (process.env.REDIS_PORT) return process.env.REDIS_PORT
if (process.env.FH_REDIS_PORT) return process.env.FH_REDIS_PORT
return 6379;
}
function getRedisHost() {
if (process.env.REDIS_HOST) return process.env.REDIS_HOST
if (process.env.FH_REDIS_HOST) return process.env.FH_REDIS_HOST
return "127.0.0.1";
}
function getRedisUrl() {
return 'redis://' + getRedisHost() + ':' + getRedisPort()
}
module.exports = config;