8000 Make it more clear which environment variables are overwritten · Issue #547 · symfony-cli/symfony-cli · GitHub
[go: up one dir, main page]

Skip to content

Make it more clear which environment variables are overwritten #547

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

Open
alexander-schranz opened this issue Dec 10, 2024 · 2 comments
Open

Comments

@alexander-schranz
Copy link
alexander-schranz commented Dec 10, 2024

Over the last years I did see a lot of people run into issue that symfony serve overwrites the DATABASE_URL depending on the things configured in the docker compose file.

I think It would be great to output the overwrites when starting the symfony serve or server:start webserver.

Currently we have the following output where we could also add a Info boxor inside the green box more information:

 [WARNING] The local web server is optimized for local development and MUST never be used in a production setup.

 [OK] Web server listening
      The Web server is using PHP FPM 8.1.31
      https://127.0.0.1:8000
      https://int3grate.wip
      
 [Info] Docker Integration Environment Variables
 
      DATABASE_URL=....
      KAFA_...=....

Currently the behaviour is only documented in https://symfony.com/doc/current/setup/symfony_server.html#docker-integration but sure most don't stumble over it and its unclear for endusers why there .env or .env.local ENVs aren't used.

@tucksaun
Copy link
Member

Nice idea.

We already provide the information that the Docker or SymfonyCloud Integration is enabled in the WDT.
But showing this information when starting the server might be more easy for users to catch the info.

I don't believe we should show every variables though because a lot of them would be shown (I currently have 56 variable on a small project...).
But we can show that the integration is enabled with a link to the documentation or a hint that var:export can be used to introspect them.
WDYT?

@alexander-schranz
Copy link
Author
alexander-schranz commented Dec 10, 2024

@tucksaun I understand that showing all is not good and sure not what we should do. Best outcome would be shown only the one which were overwritten by Symfony CLI.

So if its defined in the .env, .env.local, ... (or similar) files and the one Set doesn't match that one it should be shown. Overwrites DATABASE_URL=....

But we can show that the integration is enabled with a link to the documentation or a hint that var:export can be used to introspect them.

I think sadly that nobody really will run that command as for most its unclear that Variables are overwritten.

We would require to make it pretty clear with common examples if we can not do a diff between .env files and docker env variables with something like:

Warning

Docker Integration enabled: Environment variables like DATABASE_URL, ... are overwritten run symfony var:export --multiline to show the new values.

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

No branches or pull requests

2 participants
0