react-native-dotenv icon indicating copy to clipboard operation
react-native-dotenv copied to clipboard

Multi Environments

Open gcorreaalves opened this issue 7 years ago • 11 comments

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.

gcorreaalves avatar Dec 30 '17 13:12 gcorreaalves

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

zetachang avatar Jan 13 '18 16:01 zetachang

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.

gcorreaalves avatar Jan 31 '18 12:01 gcorreaalves

Any update on this? Will this be merged? This is a good to have PR.

bozzmob avatar Apr 29 '18 07:04 bozzmob

Hi @bozzmob, unfortunately I haven't tested with Xcode and Gradle yet, but it works pretty well with Expo.

gcorreaalves avatar Apr 30 '18 18:04 gcorreaalves

Any update on this?

ashishmusale avatar May 23 '18 19:05 ashishmusale

Any updates?

mitaxe avatar Feb 07 '19 14:02 mitaxe

Hi guys, I did some tests but on Xcode or Gradle it does not work.

gcorreaalves avatar Feb 07 '19 14:02 gcorreaalves

When this PR will be merged and release to npm?

peterlin99512 avatar Apr 30 '20 14:04 peterlin99512

There's a new repo and package babel-plugin-dotenv-import. Please reopen in the new repo

goatandsheep avatar May 21 '20 19:05 goatandsheep

@goatandsheep that's great! perhaps you want to update also the README mentioning the multi-environment support.

dapicester avatar May 22 '20 06:05 dapicester

@gcorreaalves @dapicester I haven't merged it yet. It needs to work on XCode and Android before we can do that

goatandsheep avatar May 22 '20 12:05 goatandsheep