The problem occurs with v0.112.0 and later.
When running certain subcommands (new, config, mod, convert, list, deploy), environment-specific configuration from all environments is applied rather than only the active one.
Cause
These subcommands bypass hugobuilder.loadConfig() where the active environment was previously resolved. With the environment unresolved, config.LoadConfigFromDir receives an empty string, causing it to walk the entire config directory — including subdirectories for non-active environments — and merge all settings together.
Example
With this config layout:
config/_default/hugo.toml
config/staging/params.toml ← myparam = "foo"
Running hugo config (environment defaults to production) incorrectly outputs:
Fix
Resolve the active environment in ConfigFromProvider before building the ConfigSourceDescriptor, mirroring the logic already present in hugobuilder.loadConfig().
The problem occurs with v0.112.0 and later.
When running certain subcommands (
new,config,mod,convert,list,deploy), environment-specific configuration from all environments is applied rather than only the active one.Cause
These subcommands bypass
hugobuilder.loadConfig()where the active environment was previously resolved. With the environment unresolved,config.LoadConfigFromDirreceives an empty string, causing it to walk the entire config directory — including subdirectories for non-active environments — and merge all settings together.Example
With this config layout:
Running
hugo config(environment defaults toproduction) incorrectly outputs:Fix
Resolve the active environment in
ConfigFromProviderbefore building theConfigSourceDescriptor, mirroring the logic already present inhugobuilder.loadConfig().