-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.config.js
More file actions
42 lines (38 loc) · 1.27 KB
/
app.config.js
File metadata and controls
42 lines (38 loc) · 1.27 KB
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
const dotenv = require('dotenv');
const pkg = require('./package.json');
dotenv.config({ quiet: true });
/** Only string/number secrets belong in extra; objects become "[object Object]" in embedded HTML. */
function extraStringOrNull(v) {
if (v == null || v === '') return null;
if (typeof v === 'string') {
const t = v.trim();
return t.length ? t : null;
}
if (typeof v === 'number' && Number.isFinite(v)) return String(v);
return null;
}
module.exports = ({ config }) => {
/** GitHub Pages project sites are served under /<repo>/; set in CI (see deploy-pages workflow). */
const basePath = (process.env.EXPO_PUBLIC_BASE_PATH || '').trim().replace(/\/+$/, '');
return {
...config,
version: pkg.version,
experiments: {
...(config.experiments || {}),
...(basePath ? { baseUrl: basePath } : {}),
},
plugins: [
...(config.plugins || []),
'expo-secure-store',
'expo-web-browser'
],
extra: {
// Preserve any existing extra values
...(config.extra || {}),
MAPBOX_ACCESS_TOKEN: extraStringOrNull(process.env.MAPBOX_ACCESS_TOKEN),
METEOBLUE_API_KEY:
extraStringOrNull(process.env.METEOBLUE_API_KEY) ??
extraStringOrNull(process.env.EXPO_PUBLIC_METEOBLUE_API_KEY),
},
};
};