-
Notifications
You must be signed in to change notification settings - Fork 1
/
env.js
45 lines (42 loc) · 1.24 KB
/
env.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
/**
* @todo should get these from a different query for full runtime changeability
*/
const prodEnv = {
NODE_ENV: 'production',
WEBSITE_ORIGIN: 'https://jameswiens.dev',
STYLIS_SHOULD_PREFIX: 'false',
GOOGLE_TAG_MANAGER_AMP_ID: 'GTM-WHL4TS3',
GOOGLE_TAG_MANAGER_WEB_ID: 'GTM-P58WR63',
GRAPHQL_API_URL: 'https://jameswiens-graphql.now.sh/graphql',
}
const devEnv = {
NODE_ENV: 'development',
WEBSITE_ORIGIN: 'http://localhost:3000',
STYLIS_SHOULD_PREFIX: 'false',
GOOGLE_TAG_MANAGER_AMP_ID: 'GTM-WHL4TS3',
GOOGLE_TAG_MANAGER_WEB_ID: 'GTM-P58WR63',
GRAPHQL_API_URL: 'https://jameswiens-graphql.now.sh/graphql',
}
const testEnv = {
NODE_ENV: 'test',
WEBSITE_ORIGIN: 'http://localhost:3000',
STYLIS_SHOULD_PREFIX: 'false',
GOOGLE_TAG_MANAGER_AMP_ID: 'AMP_ID',
GOOGLE_TAG_MANAGER_WEB_ID: 'WEB_ID',
GRAPHQL_API_URL: 'https://jameswiens-graphql.now.sh/graphql',
}
const env =
process.env.NODE_ENV === 'test'
? testEnv
: process.env.NODE_ENV !== 'production'
? devEnv
: prodEnv
Object.keys(env).forEach(key => {
process.env[key] = env[key]
})
exports.testEnv = testEnv
exports.prodEnv = prodEnv
exports.devEnv = devEnv
exports.env = env
const { NODE_ENV, ...remainingEnv } = env
exports.envWithoutNodeEnv = remainingEnv