@@ -45,11 +45,6 @@ func outputConfig(cfg *srvconfig.Config) error {
4545 Config : cfg ,
4646 }
4747
48- // for the time being, keep the defaultConfig's version set at 1 so that
49- // when a config without a version is loaded from disk and has no version
50- // set, we assume it's a v1 config. But when generating new configs via
51- // this command, generate the v2 config
52- config .Config .Version = 2
5348 plugins , err := server .LoadPlugins (gocontext .Background (), config .Config )
5449 if err != nil {
5550 return err
@@ -60,15 +55,31 @@ func outputConfig(cfg *srvconfig.Config) error {
6055 if p .Config == nil {
6156 continue
6257 }
63- config .Plugins [p .URI ()] = p .Config
58+
59+ pc , err := config .Decode (p )
60+ if err != nil {
61+ return err
62+ }
63+
64+ config .Plugins [p .URI ()] = pc
6465 }
6566 }
67+
6668 timeouts := timeout .All ()
6769 config .Timeouts = make (map [string ]string )
6870 for k , v := range timeouts {
6971 config .Timeouts [k ] = v .String ()
7072 }
7173
74+ // for the time being, keep the defaultConfig's version set at 1 so that
75+ // when a config without a version is loaded from disk and has no version
76+ // set, we assume it's a v1 config. But when generating new configs via
77+ // this command, generate the v2 config
78+ config .Config .Version = 2
79+
80+ // remove overridden Plugins type to avoid duplication in output
81+ config .Config .Plugins = nil
82+
7283 _ , err = config .WriteTo (os .Stdout )
7384 return err
7485}
0 commit comments