-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Define custom .env files for custom development stages. #3903
Comments
This seems like a reasonable proposal to me. I'd be happy to implement this if it's something we want to go ahead with. |
I agree. I have solved it in my
|
I believe there is an existing merge request for this issue.. #3178 |
There's also this PR: #3875 They both solve the problem in the same way, just with slightly different naming. I like the name suggested in this issue: |
I reached out to both of the authors of the existing PRs but neither of them have responded. Is someone else interested in taking this on? |
It looks like there's an existing package called Using this package you could create an env file for your environment (like The settings in |
@iansu I don't think this works if you are trying to deploy a static build to a staging environment that is similar to production but has different ENV vars. Unless I'm mistaken it just overrides |
@ekryski It goes like this It does override |
@ekryski Internally we use
|
With custom-env, this is possible. Just install with |
I think it would be useful to be able to define a custom
.env
file.I have three different environments my app will run on:
dev
,staging
, andproduction
.dev
andproduction
are covered, but right now it doesn't seem like there's any easy way to have separate environment variables for other stages.It would be handy if an additional environment variable could be specified to select the custom
.env
file, and use the default.env
files if the additional variable is undefined.e.g. (in Windows)
start: react-scripts start
- uses.env.development
start: "set REACT_APP_ENV=devstaging & react-scripts start"
- uses.env.devstaging
build_staging: "set REACT_APP_ENV=staging & react-scripts build"
- uses.env.staging
build: "react-scripts build"
- uses.env.production
The custom
.env
file would be overriden by the.local
version, just how it works currently withdevelopment
,production
, andtest
.I'm not confident enough to make the change myself, but it seems like adding this would require a change in the
react-scripts -> config -> jest -> env.js
file, where thedotenvFiles
variable is set (react-scripts v1.0.11).Creating this from my comment on Issue 102 A way to define custom environment variables.
The text was updated successfully, but these errors were encountered: