core
core copied to clipboard
Dynamic configuration values are not resolving correctly
Dynamic configuration values are not resolving correctly from the .env file.
Details
| Question | Answer |
|---|---|
| Relevant Bolt Version | 5.0.6 |
| Install type | Composer install |
| PHP version | 8.0 |
| Web server | Nginx |
Reproduction
The documentation says that we can specify settings in the .env file, or in a server's environment settings, but when specifying it in the .env file, the variable contains a value from the config (ex. %env(FOO)%) instead of the resolved value from the .env file.
Steps to reproduce
- Install Bolt CMS using composer.
- Configure database.
- Run
bin/console bolt:setupto perform the initial setup and load fixtures. - Add
foo: '%env(FOO)%'to theconfig/bolt/config.yaml. - Add
FOO=resolved-valueto the.envfile. - Add new meta tag
<meta name="foo" content="{{ config.get('general/foo') }}">to thepublic/theme/base-2021/partials/_master.twigfile.
Expected result
Variable resolved correctly, and the rendered pages contain a new meta tag inside the head block:
<meta name="foo" content="resolved-value">
Actual result
Rendered pages contain a new meta tag inside the head block, but the value is incorrect:
<meta name="foo" content="%env(FOO)%">
The variable is getting resolved only when specifying it in a server's environment settings.
I'm experiencing the same issue.