Environment Variables in Expo using Release Channels
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:
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
- 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.