Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 2.95 KB

File metadata and controls

58 lines (35 loc) · 2.95 KB

Configuration and Environment variables

📡 What you will learn

👾 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)

production variants in a managed project

👨‍🚀 Exercise 2

Following the documentation to add variants to your application:

  • create your app.config.js to use in your managed project
    • add a custom name for your dev app

Let's say now you want to have differents API endpoints. You can use environment variables to do that. Don't forget to follow the .env convention.

  • create a .env.local file and add your environment variables.
EXPO_PUBLIC_API_URL=https://swapi.py4e.com/
  • use process.env.EXPO_PUBLIC_API_URL to 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 SENTRY_API_KEY, you can use EAS Secrets.

To create a new secret, run :

eas env
eas env:create  // create a new secret
eas env:list    // view any existing secrets for this project
  • use eas env:create and create a fake SWAPI_KEY because 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.

👽 Bonus