-
Notifications
You must be signed in to change notification settings - Fork 5
/
env.config.js
63 lines (47 loc) · 1.74 KB
/
env.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
// Yeah, Yeah, it's a bad name and bad approach.
// it'll crash any default scripts on heroku, travis, netlify, etc.
// BUT! it give us more flexibility.
// some of key later will be easily moved into .env file
// please propose a better way in github repo issues.
//raven( Sentry keys )
const REACT_APP_SENTRY_KEY='77aa2ee9a7ce484497f56278982a0809';
const REACT_APP_SENTRY_APP='305339';
const REACT_APP_SENTRY_URL='https://${REACT_APP_SENTRY_KEY}@sentry.io/${REACT_APP_SENTRY_APP}';
//# not working right now.
//#REACT_APP_SENTRY_URL=https://$REACT_APP_SENTRY_KEY@sentry.io/$REACT_APP_SENTRY_APP
// server
//REACT_APP_BACKEND_HOST - maybe it's a better name, because if we'll add version later, this wouldn't be a real api url
const REACT_APP_SERVER_API_URL='https://xxx.herokuapp.com';
// frontend
const REACT_APP_FRONTEND_URL='https://xxx.netlify.com/';
const REACT_APP_FRONTEND_LOCAL_URL='http://localhost:3000';
// ------- this part can be moved into a separated file.
// i just keep it here because it's easy to manage
let backendHost;
const hostname = window && window.location && window.location.hostname;
if( hostname === REACT_APP_FRONTEND_URL ) {
backendHost = REACT_APP_SERVER_API_URL;
}
if( hostname === REACT_APP_FRONTEND_LOCAL_URL ) {
backendHost = 'http://localhost:3000';
}
// else if( hostname === 'staging.realsite.com' ) {
// backendHost = 'https://staging.api.realsite.com';
//
// }
// else if(/^qa/.test(hostname)) {
// backendHost = `https://api.${hostname}`;
//
// }
// else {
// backendHost = process.env.REACT_APP_BACKEND_HOST || 'http://localhost:3000';
//
// }
const API_ROOT = `${backendHost}`;
export {
REACT_APP_SENTRY_URL,
REACT_APP_SERVER_API_URL,
REACT_APP_FRONTEND_URL,
REACT_APP_FRONTEND_LOCAL_URL,
API_ROOT
}