-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
73 lines (55 loc) · 2.86 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import _ from 'lodash';
const CONST = {
PUBLIC_URL: process.env.PUBLIC_URL,
// There is also a special built-in environment variable called NODE_ENV.
// You can read it from process.env.NODE_ENV. When you run npm start, it
// is always equal to 'development', when you run npm test it is always equal
// to 'test', and when you run npm run build to make a production bundle,
// it is always equal to 'production'. You cannot override NODE_ENV manually.
// This prevents developers from accidentally deploying a slow
// development build to production.
NODE_ENV: process.env.NODE_ENV,
DEVELOPMENT: process.env.NODE_ENV === 'development',
REACT_APP_STRIPE_PUBLISHABLE_KEY: process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY || 'pk_test_PKlD56JoqROJNxZa8JoV5ILr',
REACT_APP_ORDER_API_URL: process.env.REACT_APP_ORDER_API_URL || 'http://localhost:3001',
// In production the below APIs are served on the same endpoint,
// but in development it's convenient to have them separate
REACT_APP_TILE_API_URL: process.env.REACT_APP_TILE_API_URL || 'https://tile-api.alvarcarto.com/tiles',
REACT_APP_RENDER_API_URL: process.env.REACT_APP_RENDER_API_URL || 'https://tile-api.alvarcarto.com/render',
REACT_APP_PLACEMENT_API_URL: process.env.REACT_APP_PLACEMENT_API_URL || 'https://tile-api.alvarcarto.com/placement',
REACT_APP_RENDER_API_KEY: process.env.REACT_APP_RENDER_API_KEY,
REACT_APP_ANALYTICS_ENV: process.env.REACT_APP_ANALYTICS_ENV || 'development',
REACT_APP_GEO_API_URL: process.env.REACT_APP_GEO_API_URL || 'https://freegeoip.app',
// By default design-qa.alvarcarto.com GTM ID is used
REACT_APP_GTM_ID: process.env.REACT_APP_GTM_ID,
REACT_APP_ALGOLIA_APP_ID: process.env.REACT_APP_ALGOLIA_APP_ID,
REACT_APP_ALGOLIA_API_KEY: process.env.REACT_APP_ALGOLIA_API_KEY,
REACT_APP_BRANCH: process.env.REACT_APP_BRANCH || 'master',
};
// For debugging purposes
window.BRANCH = process.env.REACT_APP_BRANCH;
if (!CONST.REACT_APP_STRIPE_PUBLISHABLE_KEY) {
throw new Error('REACT_APP_STRIPE_PUBLISHABLE_KEY must be set.');
}
if (!CONST.REACT_APP_ALGOLIA_APP_ID) {
throw new Error('REACT_APP_ALGOLIA_APP_ID must be set.');
}
if (!CONST.REACT_APP_ALGOLIA_API_KEY) {
throw new Error('REACT_APP_ALGOLIA_API_KEY must be set.');
}
if (!CONST.REACT_APP_GTM_ID) {
throw new Error('REACT_APP_GTM_ID must be set.');
}
if (_.endsWith(CONST.REACT_APP_ORDER_API_URL, '/')) {
throw new Error('Trailing slash in REACT_APP_ORDER_API_URL. Remove it.');
}
if (_.endsWith(CONST.REACT_APP_TILE_API_URL, '/')) {
throw new Error('Trailing slash in REACT_APP_TILE_API_URL. Remove it.');
}
if (_.endsWith(CONST.REACT_APP_RENDER_API_URL, '/')) {
throw new Error('Trailing slash in REACT_APP_RENDER_API_URL. Remove it.');
}
if (_.endsWith(CONST.REACT_APP_PLACEMENT_API_URL, '/')) {
throw new Error('Trailing slash in REACT_APP_PLACEMENT_API_URL. Remove it.');
}
export default CONST;