mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Simplify some config loading code
This commit is contained in:
parent
57d8d208ed
commit
df8bb8812f
1 changed files with 43 additions and 42 deletions
|
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue