Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo config env variables #116

Open
guioum opened this issue Nov 21, 2023 · 2 comments
Open

Expo config env variables #116

guioum opened this issue Nov 21, 2023 · 2 comments

Comments

@guioum
Copy link

guioum commented Nov 21, 2023

In app.config.ts, it reads multiple env variables.

These variables do not exist (bun install prefixes all variables with EXPO_PUBLIC_).

It should be EXPO_PUBLIC_EAS_PROJECT_ID, EXPO_PUBLIC_EAS_OWNER.

Also, I would recommend removing hardcoded values, to leverage env variables, and to make the template free of hardcoded values.

Something like this works for us:

import { ConfigContext, ExpoConfig } from '@expo/config'

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  extra: {
    eas: {
      projectId: process.env.EXPO_PUBLIC_EAS_PROJECT_ID,
    },
  },
  owner: process.env.EXPO_PUBLIC_EAS_OWNER,
  plugins: ['expo-router'],
  experiments: {
    tsconfigPaths: true,
    typedRoutes: true,
  },
  platforms: ['ios', 'android'],
  ios: {
    bundleIdentifier: process.env.EXPO_PUBLIC_EAS_OWNER_ID,
  },
  android: {
    package: process.env.EXPO_PUBLIC_EAS_OWNER_ID,
  },
  name: process.env.EXPO_PUBLIC_EAS_NAME,
  slug: process.env.EXPO_PUBLIC_EAS_SLUG,
  updates: {
    url:
      process.env.EXPO_PUBLIC_EAS_UPDATES_URL,
  },
  runtimeVersion: {
    policy: 'sdkVersion',
  },
})

Please note that we added new variables to .env.local, and also expo.yml.

@bmikaili
Copy link

bmikaili commented Dec 7, 2023

I'm a bit confused as well. The .env variable setup out of the box is completely broken

@timothymiller
Copy link
Owner

Seems sensible. What about app.json?
And where does expo.yml fit into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants