config: don't fail LoadConfig if file doesn't exist

When the config file doesn't exist, don't return because we need to keep
the default and also load from env.
This commit is contained in:
Achilleas Koutsou 2021-09-30 14:17:15 +02:00 committed by Tomáš Hozza
parent 2aedd3da05
commit 8393cfc322

View file

@ -97,7 +97,7 @@ func GetDefaultConfig() *ComposerConfigFile {
func LoadConfig(name string) (*ComposerConfigFile, error) {
c := GetDefaultConfig()
_, err := toml.DecodeFile(name, c)
if err != nil {
if err != nil && !os.IsNotExist(err) {
return nil, err
}
err = loadConfigFromEnv(c)