Skip to content

Commit 93c14ce

Browse files
committed
feat: update env vars loading to use default expo logic + eas secret
1 parent 97590fb commit 93c14ce

15 files changed

Lines changed: 686 additions & 329 deletions

File tree

.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Application Environment (development | preview | production)
2+
EXPO_PUBLIC_APP_ENV=development
3+
4+
# API Configuration
5+
EXPO_PUBLIC_API_URL=https://dummyjson.com/
6+
7+
# Example Variables
8+
EXPO_PUBLIC_VAR_NUMBER=10
9+
EXPO_PUBLIC_VAR_BOOL=true
10+
11+
# Build-time only secrets (no EXPO_PUBLIC prefix - NOT accessible in src folder)
12+
SECRET_KEY=my-secret-key
13+
APP_BUILD_ONLY_VAR=build-only-value

.env.production

Lines changed: 0 additions & 6 deletions
This file was deleted.

.env.staging

Lines changed: 0 additions & 6 deletions
This file was deleted.

app.config.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import type { ConfigContext, ExpoConfig } from '@expo/config';
22
import type { AppIconBadgeConfig } from 'app-icon-badge/types';
3+
import Env from './env';
34

4-
import { ClientEnv, Env } from './env';
5+
import 'tsx/cjs';
6+
7+
const EXPO_ACCOUNT_OWNER = 'obytes';
8+
const EAS_PROJECT_ID = 'c3e1075b-6fe7-4686-aa49-35b46a229044';
59

610
const appIconBadgeConfig: AppIconBadgeConfig = {
7-
enabled: Env.APP_ENV !== 'production',
11+
enabled: Env.EXPO_PUBLIC_APP_ENV !== 'production',
812
badges: [
913
{
10-
text: Env.APP_ENV,
14+
text: Env.EXPO_PUBLIC_APP_ENV,
1115
type: 'banner',
1216
color: 'white',
1317
},
1418
{
15-
text: Env.VERSION.toString(),
19+
text: Env.EXPO_PUBLIC_VERSION.toString(),
1620
type: 'ribbon',
1721
color: 'white',
1822
},
1923
],
2024
};
2125

22-
// eslint-disable-next-line max-lines-per-function
2326
export default ({ config }: ConfigContext): ExpoConfig => ({
2427
...config,
25-
name: Env.NAME,
26-
description: `${Env.NAME} Mobile App`,
27-
owner: Env.EXPO_ACCOUNT_OWNER,
28-
scheme: Env.SCHEME,
28+
name: Env.EXPO_PUBLIC_NAME,
29+
description: `${Env.EXPO_PUBLIC_NAME} Mobile App`,
30+
owner: EXPO_ACCOUNT_OWNER,
31+
scheme: Env.EXPO_PUBLIC_SCHEME,
2932
slug: 'obytesapp',
30-
version: Env.VERSION.toString(),
33+
version: Env.EXPO_PUBLIC_VERSION.toString(),
3134
orientation: 'portrait',
3235
icon: './assets/icon.png',
3336
userInterfaceStyle: 'automatic',
@@ -38,7 +41,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
3841
assetBundlePatterns: ['**/*'],
3942
ios: {
4043
supportsTablet: true,
41-
bundleIdentifier: Env.BUNDLE_ID,
44+
bundleIdentifier: Env.EXPO_PUBLIC_BUNDLE_ID,
4245
infoPlist: {
4346
ITSAppUsesNonExemptEncryption: false,
4447
},
@@ -51,7 +54,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
5154
foregroundImage: './assets/adaptive-icon.png',
5255
backgroundColor: '#2E3C4B',
5356
},
54-
package: Env.PACKAGE,
57+
package: Env.EXPO_PUBLIC_PACKAGE,
5558
},
5659
web: {
5760
favicon: './assets/favicon.png',
@@ -110,9 +113,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
110113
['react-native-edge-to-edge'],
111114
],
112115
extra: {
113-
...ClientEnv,
114116
eas: {
115-
projectId: Env.EAS_PROJECT_ID,
117+
projectId: EAS_PROJECT_ID,
116118
},
117119
},
118120
});

0 commit comments

Comments
 (0)