Config: don't override undefined keys when loading from ENV
Composer can load configuration values defined as map from ENV. Previously, when loading the configuration from ENV, the whole map would get overridden, not just values defined in the ENV. This is however not intended and not consistent with how loading configuration from file works. Adjust the configuration loading from ENV and adjust the unit test accordingly. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
62ae5aa4ea
commit
286236b698
2 changed files with 10 additions and 6 deletions
|
|
@ -170,12 +170,12 @@ func TestConfigFromEnv(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
os.Setenv("DISTRO_ALIASES", "rhel-7=rhel-7.9,rhel-8=rhel-8.9,rhel-9=rhel-9.3,rhel-10.0=rhel-9.5")
|
||||
os.Setenv("DISTRO_ALIASES", "rhel-7=rhel-7.9,rhel-8=rhel-8.9,rhel-9=rhel-9.3")
|
||||
expectedDistroAliases := map[string]string{
|
||||
"rhel-7": "rhel-7.9",
|
||||
"rhel-8": "rhel-8.9",
|
||||
"rhel-9": "rhel-9.3",
|
||||
"rhel-10.0": "rhel-9.5",
|
||||
"rhel-7": "rhel-7.9",
|
||||
"rhel-8": "rhel-8.9",
|
||||
"rhel-9": "rhel-9.3",
|
||||
"rhel-10": "rhel-10.0", // this value is from the default config
|
||||
}
|
||||
|
||||
config, err := LoadConfig("")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue