forked from putaindecode/putaindecode.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.js
35 lines (31 loc) · 810 Bytes
/
variables.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
// shell has some limitation :)
const __PROD__ = process.argv.includes("--production")
const variables = {
__DEV__: !__PROD__,
__PROD__,
__SERVER_PROTOCOL__: "http://",
...(
__PROD__ ?
{
__SERVER_HOSTNAME__: "putaindecode.fr",
__SERVER_HOST__: "putaindecode.fr",
"process.env": {
NODE_ENV: JSON.stringify("production"),
},
}
:
{
__SERVER_HOSTNAME__: "0.0.0.0",
__SERVER_PORT__: 4242,
__SERVER_HOST__: "0.0.0.0:4242",
__LR_SERVER_PORT__: 4243,
}
),
}
variables.__SERVER_URL__ =
`${variables.__SERVER_PROTOCOL__}${variables.__SERVER_HOST__}`
export default variables
// define some global var like __DEV__
export function defineGlobalVariables() {
Object.keys(variables).forEach((k) => global[k] = variables[k])
}