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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-env doesn't change #197
Comments
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/197 |
How are you setting which environment you're using for your server? Are you using node_env? App_env? Setting it in your configs? Let's figure this out. |
Updated. Please see in my question |
I understand correctly that NODE_ENV indicates which file to use? |
Try applying the environment setting to your run script instead and let me know what happens |
Could you give me an example? |
Sorry for the delay. I'm just doing a bit of research into the problem |
Did you manage to reproduce it? |
Working on it here https://github.com/goatandsheep/react-native-dotenv-metro-demo |
Also tell me please, can I get a variable NODE_ENV from other places? For example from gitlab CI? |
so I did find a bug actually. On gitlab CI my recommendation would be to do the same thing, which is run |
will be fixed in |
@KonstantinZhukovskij if this change helps you, I request if you can make a donation, please do |
I updated and it works great with npm scripts. Thank you very much for your work. |
@goatandsheep I asked yesterday about whether I can set the NODE_ENV constant from other places, for example, from gitlab CI? Now I tried to build a test assembly and got a production environment everywhere. Could this be a library problem? What are the ways to create a constant NODE_ENV? |
That's bizarre! In test, you should get test. I don't think I know what you mean by set node_env everywhere. Can you please expand on that? |
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/197 |
@goatandsheep This is part of my code inside the gitlab CI. I am trying to understand whether it is possible to indicate the environment in this way? If I specify the NODE_ENV constant here, is it the same as I specified in the npm script
|
So the module should support reading the global NODE_ENV. However, I haven't tested it in this way yet. Also, for adding process.env variables into the mix, that is also in a pending PR. Go take a look if you're interested #191 If you want "staging", don't use "stage". Also, if you're not using test, development, or production, you're in experimental territory that I do not advise on a tight timeline. |
What do you mean? |
Sorry about that message that was sent from my phone. Let me expand: Disclaimer: I haven't used firebase config, I just saw: environment:
name: stage so I assumed that it would use I also don't know if this works, but I haven't tried: variables:
NODE_ENV: 'staging' I recommend you set And regarding variables:
BUILD_DESTINATION: 'firebase'
APP_IDENTIFIER: 'myID' These will only load if #191 is merged |
@goatandsheep Are you going to merge it? |
I'm waiting to see if I can get some support before I do as it's a major feature |
@goatandsheep Could you create a new branch with the latest changes and #191 ? |
@goatandsheep I made a patch with your changes #191 and tested it, but it still doesn't work. I am not getting data from my environment files, although I did get the NODE_ENV constant. However, there is a problem with the NODE_ENV, it is always development. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Multi-env doesn't change. I always get variables from .env.development, most likely because this file is the first in the folder. I have the folder with 3 files:
.env.development .env.staging .env.production
. I've tried cleaning, reinstalling, and many more options, but nothing seems to work.My npm scripts:
I also use the next script:
"babel-clear": "rimraf node_modules/.cache/babel-loader/*,"
My babel config:
In my file index.js
import { URL } from '@env';
"react": "17.0.1",
"react-native": "0.64.1",
"react-native-dotenv": "^3.0.0",
The text was updated successfully, but these errors were encountered: