Configuration and Environment variables
📡 What you will learn
- Difference between development builds with
expo-dev-clientand Expo Go.
- Configuring development and production variants in a managed project.
.envfiles to manage your environment variables.
👾 Before we start the exercise
- Check this video to understand what is the difference between Expo Go and Expo Custom Development Client.
In this challenge we are going to put everything in place that you can have these variants on your app (Dev and production)
👨🚀 Exercise 2
Following the documentation to add variants to your application:
- create your
app.config.jsto use in your managed project
- add a custom name for your dev app
- create a
.env.localfile and add your environment variables.
process.env.EXPO_PUBLIC_API_URLto call the Star Wars API in your app.
In real situations, you may have multiple enpoints depending on the environment. Here is how you can set differents build profiles.
🔥 Never commit sensitive information!
If you want to store secret key in your repository like
GOOGLE_MAPS_IOS_API_KEY, you can use EAS Secrets.
To create a new secret, run :
eas secret:create // create a new secret eas secret:list // view any existing secrets for this project
eas secret:createand create a fake
SWAPI_KEYbecause there is no API key for the Star Wars API.
In the next lesson, we are going to build your app and show you how to install it on your phone.