Home > Software design >  Symfony - can't work out where DB config is being loaded from
Symfony - can't work out where DB config is being loaded from

Time:10-26

I must be doing something stupid, but I just can't work it out.

I'm running a Symfony project which is connecting to a Postgres DB on different machine on the local network. The Postgres database details are currently defined in .env and work as expected. I want to move to using Symfony 'secrets' and remove the user/pw details from .env

Whilst testing, I ended up removing .env altogether and also removing the secret, yet the webpage is still successfully loading all the data from the DB. I'm now trying to work out why it is still working. Are the DB details cached somewhere on the server? Where else could they be loading from?

CodePudding user response:

  1. It can be the cache (configurations are also cached), use bin/console cache:clear to be sure.
  2. Make sure you Server does no define the env variables by it self. Some server do not load the env variable from the env file. Instead you have to define them explicit in the server configuration.
  • Related