aboutsummaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-07-31 11:20:37 +0200
committerBjørn Erik Pedersen <[email protected]>2023-07-31 11:20:37 +0200
commitc1df5b1b0b032b4ee926369c2325aca0de93c67c (patch)
tree628ca2b937b2cdfdb1a2bb0e9dfe0c85f91d3ba5 /config
parentbe8e2de59786327a83a1b41bb9f9608a49b5f7a0 (diff)
downloadhugo-c1df5b1b0b032b4ee926369c2325aca0de93c67c.tar.gz
hugo-c1df5b1b0b032b4ee926369c2325aca0de93c67c.zip
config: Do not fail on unknown config keys
Make it a warning. One such example I found in an old site is `blackfriday`. These should be fixed/removed, but it's not important enough to fail the build.
Diffstat (limited to 'config')
-rw-r--r--config/allconfig/allconfig.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/config/allconfig/allconfig.go b/config/allconfig/allconfig.go
index 1c1b0b990..134df1f5c 100644
--- a/config/allconfig/allconfig.go
+++ b/config/allconfig/allconfig.go
@@ -744,7 +744,7 @@ func fromLoadConfigResult(fs afero.Fs, logger loggers.Logger, res config.LoadCon
all := &Config{}
- err := decodeConfigFromParams(fs, bcfg, cfg, all, nil)
+ err := decodeConfigFromParams(fs, logger, bcfg, cfg, all, nil)
if err != nil {
return nil, err
}
@@ -832,7 +832,7 @@ func fromLoadConfigResult(fs afero.Fs, logger loggers.Logger, res config.LoadCon
// Create a copy of the complete config and replace the root keys with the language specific ones.
clone := all.cloneForLang()
- if err := decodeConfigFromParams(fs, bcfg, mergedConfig, clone, differentRootKeys); err != nil {
+ if err := decodeConfigFromParams(fs, logger, bcfg, mergedConfig, clone, differentRootKeys); err != nil {
return nil, fmt.Errorf("failed to decode config for language %q: %w", k, err)
}
if err := clone.CompileConfig(logger); err != nil {
@@ -904,7 +904,7 @@ func fromLoadConfigResult(fs afero.Fs, logger loggers.Logger, res config.LoadCon
return cm, nil
}
-func decodeConfigFromParams(fs afero.Fs, bcfg config.BaseConfig, p config.Provider, target *Config, keys []string) error {
+func decodeConfigFromParams(fs afero.Fs, logger loggers.Logger, bcfg config.BaseConfig, p config.Provider, target *Config, keys []string) error {
var decoderSetups []decodeWeight
@@ -917,7 +917,7 @@ func decodeConfigFromParams(fs afero.Fs, bcfg config.BaseConfig, p config.Provid
if v, found := allDecoderSetups[key]; found {
decoderSetups = append(decoderSetups, v)
} else {
- return fmt.Errorf("unknown config key %q", key)
+ logger.Warnf("Skip unknown config key %q", key)
}
}
}