Update config migrations to decode using the plugin type
Ensure migration picks up defaults and correct ordering from the plugin configuration. Ensures that the migration matches the behavior of the default output and how the configuration will be loaded. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
15713014d6
commit
eb9925d88c
@ -123,6 +123,28 @@ var configCommand = cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
plugins, err := server.LoadPlugins(ctx, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(plugins) != 0 {
|
||||
if config.Plugins == nil {
|
||||
config.Plugins = make(map[string]interface{})
|
||||
}
|
||||
for _, p := range plugins {
|
||||
if p.Config == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
pc, err := config.Decode(ctx, p.URI(), p.Config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config.Plugins[p.URI()] = pc
|
||||
}
|
||||
}
|
||||
|
||||
config.Version = srvconfig.CurrentConfigVersion
|
||||
|
||||
return toml.NewEncoder(os.Stdout).SetIndentTables(true).Encode(config)
|
||||
|
Loading…
Reference in New Issue
Block a user