Parse environment variables also when set through other means than the .env files we currently expect

Created on 2 July 2019, almost 6 years ago
Updated 6 February 2025, 3 months ago

Problem/Motivation

Environment variable overrides are only supported when they are written in a .env file in a special location.

Proposed resolution

parse all environment variables that have a key we expect.

Remaining tasks

drop hard dependency on symfony/dotenv in composer.json and just suggest it instead.
write patch loading all environment variables.
load the env files from the current locations if dotenv is available and files exist.

User interface changes

none.

API changes

environment variables are checked independently of the file.

Data model changes

none

Release notes snippet

Config overrides are loaded from environment variables independently on how they are set.

original ticket

Support override configs of config_split module. In this case, environment variable names would be suggested. This would be useful when .env file location is unknown or envvar was defined by the docker container.

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine voleger Ukraine, Rivne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @voleger opened merge request.
  • πŸ‡ΊπŸ‡¦Ukraine voleger Ukraine, Rivne

    Updates here:
    - added the test for a new feature
    - updated override provider
    - added drush command to figure out the environment variable name and test override to the already loaded environment.

    Added usage examples in the documentation to the command. I really recommend to play around with that command)

    Please review MR !12

    I'm closing MR !4 as it opened against the unsupported branch.

  • πŸ‡ΊπŸ‡¦Ukraine voleger Ukraine, Rivne

    I've observed an issue with the assignment of nested values.
    Currently, it does not assign a value to the correct config object key.
    Drush command prints the original config value, overridden, and value from an environment variable if present.
    So, keys at the 0 level are assigned correctly during override. However, nested has to expand string key representation into an array-like structure.

Production build 0.71.5 2024