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

Added a feature to optionally override existing environment variables set by the system #1043

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

VarunAgw
Copy link

@VarunAgw VarunAgw commented Apr 5, 2025

Fixes #1042

@VarunAgw VarunAgw changed the title issue-1024 Added a feature to optionally override existing environment variables set by the system Added a feature to optionally override existing environment variables set by the system Apr 5, 2025
@nicolas-grekas
Copy link
Member

Can you expand? Why can't you set your real env var to the value you need? Or why can't you remove said real env vars instead?
You can already override real env vars by listing them in the SYMFONY_DOTENV_VARS env var. Isn't this a better way to cover your use case?
Adding options adds complexity. Better not if possible.

@VarunAgw
Copy link
Author

VarunAgw commented Apr 7, 2025

Hi @nicolas-grekas

Here is my code structure

.env

  • Some data

.env.local

  • APP_ENV=prod_conf1

.env.prod_conf1

  • APP_ENV=prod
  • APP_NAME=conf1
  • some more data

.env.prod_conf2

  • APP_ENV=prod
  • APP_NAME=conf2
  • some more data

Without an override flag, I can't override the value of APP_ENV in .env.prod_conf1

@VarunAgw
Copy link
Author

VarunAgw commented Apr 7, 2025

I can't override APP_ENV using SYMFONY_DOTENV_VARS feature.

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 this pull request may close these issues.

Allow override of existing environment variables set by the system optionally via a flag in DumpEnvCommand
2 participants