chore: do not load config options more than once

do not set options for the configuration when it already has been set

this allows several prompt engines being created in a single runtime
This commit is contained in:
maxlandon 2022-12-30 15:54:13 +01:00 committed by Jan De Dobbeleer
parent 4b880fec49
commit 3559254292

View file

@ -113,11 +113,14 @@ func loadConfig(env platform.Environment) *Config {
config.AddDriver(yaml.Driver)
config.AddDriver(json.Driver)
config.AddDriver(toml.Driver)
config.WithOptions(func(opt *config.Options) {
opt.DecoderConfig = &mapstructure.DecoderConfig{
TagName: "json",
}
})
if config.Default().IsEmpty() {
config.WithOptions(func(opt *config.Options) {
opt.DecoderConfig = &mapstructure.DecoderConfig{
TagName: "json",
}
})
}
err := config.LoadFiles(configFile)
if err != nil {