mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Simplify some config loading code
This commit is contained in:
@@ -167,12 +167,15 @@ func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is invoked both after we load the main config and at the end
|
||||||
|
// to support OS env override of config options used in the module collector.
|
||||||
applyOsEnvOverrides := func() error {
|
applyOsEnvOverrides := func() error {
|
||||||
|
if d.Environ == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
const delim = "__env__delim"
|
const delim = "__env__delim"
|
||||||
|
|
||||||
// Apply environment overrides
|
|
||||||
if len(d.Environ) > 0 {
|
|
||||||
// Extract all that start with the HUGO prefix.
|
// Extract all that start with the HUGO prefix.
|
||||||
// The delimiter is the following rune, usually "_".
|
// The delimiter is the following rune, usually "_".
|
||||||
const hugoEnvPrefix = "HUGO"
|
const hugoEnvPrefix = "HUGO"
|
||||||
@@ -222,8 +225,6 @@ func LoadConfig(d ConfigSourceDescriptor, doWithConfig ...func(cfg config.Provid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user