-
Notifications
You must be signed in to change notification settings - Fork 1
/
environment.example
68 lines (55 loc) · 1.5 KB
/
environment.example
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
/** ***************************
* environment.js
* path: '/environment.js'
***************************** */
/* Modified from https://alxmrtnz.com/thoughts/2019/03/12/environment-variables-and-workflow-in-expo.html#comment-4589309119 */
/*
USAGE:
import getEnvVars from '../../environment';
*/
/*
Replace the following lines in `lib/airtable.js` (starting with this one)
const ENDPOINT_URL = 'https://api.airtable.com';
const { BASE_ID, AIRTABLE_API_KEY } = getEnvVars();
Airtable.configure({
endpointUrl: ENDPOINT_URL,
apiKey: AIRTABLE_API_KEY,
});
const base = Airtable.base(BASE_ID);
*/
import Constants from 'expo-constants';
const DEV_BASE_ID = 'appYfW7a2loPD26Vg';
const PROD_BASE_ID = 'app4fXK49bqcjDMEo';
const AIRTABLE_API_KEY = 'YOUR-API-KEY';
// For Sentry logging
const staticEnvVars = {
SENTRY_ORG: 'calblueprint',
SENTRY_PROJECT: 'dccentralkitchen-clerks',
SENTRY_AUTH_TOKEN: 'YOUR-SENTRY-AUTH-TOKEN',
};
const ENV_VARIABLES = {
dev: {
BASE_ID: DEV_BASE_ID,
AIRTABLE_API_KEY,
},
prod: {
BASE_ID: PROD_BASE_ID,
AIRTABLE_API_KEY,
},
};
// If releaseChannel not set, use process.env.NODE_ENV as substitute
const env =
Constants.manifest.releaseChannel || process.env.NODE_ENV === 'production'
? 'prod'
: 'dev';
const getEnvVars = () => {
if (__DEV__) {
return ENV_VARIABLES.dev;
}
if (env === 'prod') {
return ENV_VARIABLES.prod;
}
// Fall through to dev
return ENV_VARIABLES.dev;
};
export { getEnvVars as default, staticEnvVars, env };