Closed
Description
Description
As an enhancement to #23901, It would be nice to support recursive env var resolution. It is not obvious from the docs or PR (unless i'm missing something), that this is not already supported, so I went around in circles trying to make it work for a while, until Nicolas helped me.
Example
Given environment variables:
DATABASE_URL=postgres://user:%env(DATABASE_PASSWORD)%@127.0.0.1:5432/database
DATABASE_PASSWORD=foo
And some configuration:
parameters:
env(DATABASE_PASSWORD): ''
env(DATABASE_URL): ''
doctrine:
...
url: '%env(resolve:DATABASE_URL)%'
DATABASE_PASSWORD
in DATABASE_URL
should be resolved, but it is not.
Current Workaround
You must instead use an intermediary parameter:
DATABASE_URL=postgres://user:%database_password%@127.0.0.1:5432/database
DATABASE_PASSWORD=foo
parameters:
database_password: '%env(DATABASE_PASSWORD)'
env(DATABASE_PASSWORD): ''
env(DATABASE_URL): ''
doctrine:
...
url: '%env(resolve:DATABASE_URL)%'