core icon indicating copy to clipboard operation
core copied to clipboard

Dynamic configuration values are not resolving correctly

Open aLLeXUs opened this issue 5 years ago • 1 comments

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

  1. Install Bolt CMS using composer.
  2. Configure database.
  3. Run bin/console bolt:setup to perform the initial setup and load fixtures.
  4. Add foo: '%env(FOO)%' to the config/bolt/config.yaml.
  5. Add FOO=resolved-value to the .env file.
  6. Add new meta tag <meta name="foo" content="{{ config.get('general/foo') }}"> to the public/theme/base-2021/partials/_master.twig file.

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.

aLLeXUs avatar Nov 08 '21 12:11 aLLeXUs

I'm experiencing the same issue.

dsdeboer avatar Nov 11 '21 20:11 dsdeboer