-
-
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
[feature] Implement dotenv-expand to accept variable expansion in dot env files #2223
Comments
🚷 Keep in mind DB_PASSWORD=test1234 console.log(process.env.NODE_ENV); Result will be console.log({"DB_PASSWORD":"test1234", "NODE_ENV":"production"}.NODE_ENV) |
…ble expansion in dot env files
Also particularly useful for accessing properties in package.json, which are exposed as npm_package_* environment variables. For examples, |
Json loader will do this |
Sure - they are many ways to load a json file, however, most will expose the entirety of the file to the build bundle (see #2466). Method requested here and fulfilled by linked PR will allow cherry picking which vars get exposed. |
This looks neat. I wouldn't mind taking a PR for this, but I'll close this issue since we likely won't add this ourselves. |
I merged #3387. |
This is out in |
FYI, to include an underscore in your expression use the
where
|
…ble expa… (facebook#3387) * fix facebook#2223 - [feature] Implement dotenv-expand to accept variable expansion in dot env files * add to README TOC * fix readme * Update README.md
…ble expa… (facebook#3387) * fix facebook#2223 - [feature] Implement dotenv-expand to accept variable expansion in dot env files * add to README TOC * fix readme * Update README.md
…ble expa… (facebook#3387) * fix facebook#2223 - [feature] Implement dotenv-expand to accept variable expansion in dot env files * add to README TOC * fix readme * Update README.md
Currently we use the
dotenv
library to parse a.env
file in the project root and populateprocess.env
. Great!Although there exists scenarios in large scale deployments where the same environment variables are used accross many "app" or "services" or "containers"... For example
We have websites, API services and databases consuming a base set of environment variables such as:
We don't want to have to add another set to this simply with the leading key
REACT_APP_XXX
. Dotenv has a has a sister project / plugin called dotenv-expand that allows, wait for it.... variable expansion in the file! e.g.The text was updated successfully, but these errors were encountered: