-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
54 lines (41 loc) · 1.67 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
// This file serves as the entrypoint to all configuration loaded by the
// application. All defaults are assumed here, validation should also be
// completed here.
require('dotenv').config()
// ==============================================================================
// CONFIG INITIALIZATION
// ==============================================================================
const CONFIG = {
MONGO_URL: process.env.MONGO_URL,
PORT: parseInt(process.env.PORT, 10) || 3000,
SESSION_SECRET: process.env.SESSION_SECRET || null,
NOTIFIER_URL: process.env.NOTIFIER_URL,
// ------------------------------------------------------------------------------
// Keycloak configuration
// ------------------------------------------------------------------------------
KEYCLOAK_CONFIG: {
'realm': process.env.AUTH_REALM,
'auth-server-url': process.env.AUTH_SERVER_URL,
'ssl-required': 'external',
'resource': process.env.AUTH_CLIENT,
'bearer-only': true,
'confidential-port': 0
},
KEYCLOAK_TOKEN_ENDPOINT: process.env.AUTH_SERVER_URL + '/realms/' + process.env.AUTH_REALM + '/protocol/openid-connect/token',
CREDENTIALS_ADMIN_TEST: {
'client_id': process.env.AUTH_CLIENT || null,
'grant_type': 'password',
'username': process.env.ADMIN_TEST_USERNAME || null,
'password': process.env.ADMIN_TEST_PASSWORD || null
},
SETUP: {
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'My community',
COMMUNITY_COLOR: '#' + (process.env.COMMUNITY_COLOR_HEX || '3177cc')
}
}
if (!CONFIG.SESSION_SECRET) {
throw new Error(
'SESSION_SECRET must be provided in the environment to sign the session ID cookie'
)
}
module.exports = CONFIG