Environment Variables in Expo using Release Channels

Peter Piekarczyk
Jan 2, 2018 · 1 min read
Photo by Sergii Bozhko on Unsplash

Expo has recently released Release Channels that allow you to deploy, rollback and test your app with different users by just adding the --release-channel flag on the publish command.

One of my favorite things about Release Channels is the ability to define pseudo environment variables so I can easily switch between dev, staging & prod.

Here’s how I do it:

An example of handling environment variables in Expo using Release Channels

The reason why I use indexOf is because I’ll release new versions of my app based on the package.json version. That way I keep things sync’d up across the entire Orchard ecosystem:

exp publish --release-channel staging-1.20.1
exp publish --release-channel staging-1.21.0
exp publish --release-channel prod-2.0.0

**Note:

  • In the current release of Expo v24, the releaseChannel key DOES NOT show up in dev mode.
  • In future releases, the releaseChannel key may show up as undefined. DO NOT quote me on this, its just speculation.

Fun things to do:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store