-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
59 lines (52 loc) · 1.64 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
const path = require('path')
const determineURL = () => {
if (process.env.HOST && process.env.HTTPS) {
return `https://${process.env.HOST}`
}
if(process.env.HOST && !process.env.HTTPS) {
return `http://${process.env.HOST}`
}
if(process.env.HOST === '' && process.env.HTTPS) {
return 'https://localhost'
}
return 'http://localhost'
}
const socketURL = () => {
const port = process.env.OPE_PORT || 3000
if (process.env.HTTPS === 'true') {
return `wss://${process.env.OPE_HOST}:${port}`
}
return `ws://${process.env.OPE_HOST}:${port}`
}
// prefix server settings with OPE_ to avoid naming conflicts with vue.js
module.exports = {
app: {
host: process.env.OPE_HOST || 'localhost',
rootURL: determineURL(),
socketURL: socketURL(),
https: process.env.OPE_HTTPS === 'true' || false,
port: parseInt(process.env.OPE_PORT, 10) || 3000,
jwtSecret: process.env.OPE_SECRET || '1CBFA92540817289522D82D20C02A09C',
imageRoute: '/images',
imageFolder: path.resolve(__dirname, './static/images'),
exportRoute: '/exports',
clientCacheTime: 1000 * 60 * 30,
questionCacheTime: 1000 * 60,
playground: '/playground',
endpoint: '/graphql',
},
db: {
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT, 10) || 27017,
name: process.env.DB_NAME || 'openproductevaluation',
},
seeder: {
database: {
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT, 10) || 27017,
name: process.env.DB_NAME || 'openproductevaluation',
},
inputPath: path.resolve(__dirname, './tests/seeds/data'),
dropDatabase: true,
},
}