I've just migrated my project from 3.4 to 4.4 and having a trouble to configure it correctly. My project is running inside a Docker container. I provide an env variable DATABASE_URL with a production url inside container:
env | grep DATABASE_URL - returns a correct value when I run this command inside the container.
Meanwhile my .env file contains:
...
DATABASE_URL=dummy-url-for-local-development
But when I run composer dump-env it takes dummy url instead of the one from the docker container, yet the documentation clearly states that
Any existing env vars are never overwritten by the values defined in .env, so you can combine both.
What am I doing wrong?
P.S. I expect that any system env var would be prior to what I have in .env file.
CodePudding user response:
The composer dump-env
is only compiling .env files. It does not look for real environment variables: there could be too many of them, probably unrelated to the Symfony application.
This won't prevent your app from being correctly configured as the system environment variables do take precedence over .env files.
You should see the Docker defined value by running:
./bin/console debug:container --env-vars