Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 .env file override order is slightly off compared to dotenv-flow #397

Closed
walkerdb opened this issue Dec 23, 2022 · 9 comments 路 Fixed by #398
Closed

馃悰 .env file override order is slightly off compared to dotenv-flow #397

walkerdb opened this issue Dec 23, 2022 · 9 comments 路 Fixed by #398
Assignees

Comments

@walkerdb
Copy link

dotenv-flow describes their override order as the following:

  1. base .env
  2. .env.local
  3. .env.[environment]
  4. .env.[environment].local
  5. ...local environment variables

However this library's current override order is:

  1. base .env
  2. .env.[environment]
  3. .env.local
  4. .env.[environment].local
  5. ...local environment variables

with 2 and 3 swapped compared to dotenv-flow. This order is defined by a series of object assignments here: https://github.com/goatandsheep/react-native-dotenv/blob/main/index.js#L93-L94

Can this be switched around to match dotenv-flow's approach instead?

@github-actions
Copy link

Hey, thank you for opening this issue! 馃檪 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/397

@goatandsheep
Copy link
Owner

That is bad and sloppy. I'll take a look

@elitenas
Copy link

I am still seeing this as an issue.

.env.development is taking priority over .env.local

@goatandsheep
Copy link
Owner

I will have to double check

@elitenas
Copy link

elitenas commented Feb 20, 2023

@goatandsheep .env.local takes priority over .env.production which is good. I am only seeing this issue between .env.local and .env.development

More info on order below:

https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used

image

@goatandsheep goatandsheep reopened this Feb 21, 2023
@github-actions
Copy link

Hey, thank you for opening this issue! 馃檪 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/397

@goatandsheep
Copy link
Owner

Hi @elitenas can you send me your babel configuration / reproduction details?

@elitenas
Copy link

Here is a barebone repro project: https://drive.google.com/file/d/1U9sGA3cvVLKW6caPdSVvip79u5ByH7E-/view?usp=sharing

In the repro project, i am outputting the value of API_URL. I am seeing the value show up as http://testing.com instead of http://testing222.com.

even though .env.local should have higher priority

@goatandsheep
Copy link
Owner

Hi @elitenas I'm closing this as this is an old issue and the new issue is #415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants