react-native-dotenv
react-native-dotenv copied to clipboard
Multi Environments
Yeah! I know many people have been asking for multi environments. I don't wanna boring you one more time, but I have done some changes to permit that it works. ;)
I know that Babel uses just development or production options, for this reason I changed to read other variable (ENV_FILE) first.
Examples with Expo: ENV_FILE=.env.production exp p ENV_FILE=.env.beta exp p --release-channel beta
At my company we have used this solution, and it works pretty well.
I also wrote some tests. So, you decide if it's worth to be included in the project. Even though it is a Babel Plugin, I think so. :)
I created this repository https://github.com/gcorreaalves/babel-plugin-dotenv just to install the package with the new changes for while, otherwise it doesn't work, but if you accept my PR you can republish it on NPM.
Hi @gcorreaalves , thanks for working on this! This looks like an elegant solution, have you encounter any issue while building directly with Xcode or Gradle (for Android)?
Hi @zetachang, I'm glad you have liked it. So far, I haven't tried it using Xcode or Gradle. I gonna do it soon as possible and I let you know if it works.
Any update on this? Will this be merged? This is a good to have PR.
Hi @bozzmob, unfortunately I haven't tested with Xcode and Gradle yet, but it works pretty well with Expo.
Any update on this?
Any updates?
Hi guys, I did some tests but on Xcode or Gradle it does not work.
When this PR will be merged and release to npm?
There's a new repo and package babel-plugin-dotenv-import. Please reopen in the new repo
@goatandsheep that's great! perhaps you want to update also the README mentioning the multi-environment support.
@gcorreaalves @dapicester I haven't merged it yet. It needs to work on XCode and Android before we can do that