yiisoft / config

Configuration management
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

Support configuration group aliases #126

Closed samdark closed 1 year ago

samdark commented 1 year ago

Problem

  1. I want to customize group names in my app.
  2. I still want to be able to use configs provided by packages.
  3. Packages provide packages for defined group names.

Solution

Introduce ability to map group names:

$config->withGroupNameAliases([
    'common' => 'container',
    'web' => 'container-web',
]);

Current solution w/o extra feature

In composer.json:

"extra": {
     "config-plugin": {
         "container": "$common",
         "container-web": "$web"
     }
}
vjik commented 1 year ago

Solution with mapping assumes the presence of two places with configuration of configs: 1) place where used withGroupNameAliases(). 2) place with base configuration (extra section in composer.json or separate PHP-file).

It's difficult to understand and find places where this is changing.

Of course, we can additional options to base configuration (extra section in composer.json or separate PHP-file), but why, if we can use second solution without extra feature?

samdark commented 1 year ago

I agree. 2nd way should be enough.