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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for default expansion of environment variables by bumping dotenv-expand dependency #12824

Open
hovsater opened this issue Nov 4, 2022 · 1 comment

Comments

@hovsater
Copy link

hovsater commented Nov 4, 2022

Is your proposal related to a problem?

Sometimes you may depend on environment variables in some way and may want to provide a default value in case one is not set. For instance, we have an API gateway that we need to configure locally and it's based on the current URL. In .env we set it up as follows:

REACT_APP_API_GATEWAY_BASE_URL=localhost:${PORT}

This works as long as PORT is set. create-react-app defaults to port 3000 in case it's not set. Ideally, we'd like to express that in our .env file using default expansion:

REACT_APP_API_GATEWAY_BASE_URL=localhost:${PORT:-300}

Unfortunately, this doesn't work as the current version of dotenv-expand does not support it. Default expansion was introduced in 6.0.0.

Describe the solution you'd like

Consider bumping dotenv-expand (and by extension, dotenv) to at least version 6.0.1 to add support for default expansion (e.g., ${VAR:-DEFAULT}. This is helpful when you want to provide a default value in case an environment variable isn't set.

Describe alternatives you've considered

None.

Additional context

None.

@opterion
Copy link

opterion commented Jun 2, 2023

Hi) Any updates about this issue? Would it be added in the nearest future?

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

No branches or pull requests

2 participants