Environment Variables in Expo using Release Channels

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:

--

--

--

Just a millennial looking for a feature-free rewrite.

Love podcasts or audiobooks? Learn on the go with our new app.

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
Peter Piekarczyk

Peter Piekarczyk

Just a millennial looking for a feature-free rewrite.

More from Medium

How’s the weather outside? Learn to integrate Site Kit in a Weather Application in React Native

Top 9 React Development Tools For Faster Application!

Reddit user authentication with RTK Query

Let’s Create a Web Application Using React JS in 20 Minutes. No Need for a 10 Hour Video — Part 1