-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.js
51 lines (43 loc) · 1.34 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
/*
Session Config
*/
const SESSION_SECRET = process.env.GS_SESSION_SECRET || 'some nice key'
const SessionStoreType = {
MEMORY: 'memory',
REDIS: 'redis',
}
const SESSION_STORE = process.env.GS_SESSION_STORE || SessionStoreType.REDIS
const REDIS_SOCKET = (() => {
// used by docker-compose
if (process.env.GS_REDIS_TCP_ADDR)
return `redis://${process.env.GS_REDIS_TCP_ADDR}:6379`
if (process.env.GS_REDIS_URL)
return process.env.GS_REDIS_URL
if (process.env.REDISCLOUD_URL)
return process.env.REDISCLOUD_URL
return 'redis://localhost:6379/0'
})()
/*
GraphQL Config
*/
const APP_PORT = process.env.PORT || 5000
const APP_URL = process.env.GS_APP_URL || `http://localhost:${APP_PORT}`
const GRAPHQL_URL = process.env.GS_GRAPHQL_URL || ''
const OAUTH2_AUTHORIZATION_URL = process.env.GS_OAUTH2_AUTHORIZATION_URL || '/some-url'
const OAUTH2_TOKEN_URL = process.env.GS_OAUTH2_TOKEN_URL || '/some-url'
const OAUTH2_CLIENT_ID = process.env.GS_OAUTH2_CLIENT_ID || 'a-token'
const OAUTH2_CLIENT_SECRET = process.env.GS_OAUTH2_CLIENT_SECRET || 'a-token'
const OAUTH2_CALLBACK_URL = `${APP_URL}/auth/callback`
module.exports = {
SESSION_SECRET,
SessionStoreType,
SESSION_STORE,
REDIS_SOCKET,
APP_PORT,
GRAPHQL_URL,
OAUTH2_AUTHORIZATION_URL,
OAUTH2_TOKEN_URL,
OAUTH2_CLIENT_ID,
OAUTH2_CLIENT_SECRET,
OAUTH2_CALLBACK_URL,
}