(ctx context.Context, config *srvconfig.Config)
| 37 | ) |
| 38 | |
| 39 | func outputConfig(ctx context.Context, config *srvconfig.Config) error { |
| 40 | plugins, err := server.LoadPlugins(ctx, config) |
| 41 | if err != nil { |
| 42 | return err |
| 43 | } |
| 44 | if len(plugins) != 0 { |
| 45 | if config.Plugins == nil { |
| 46 | config.Plugins = make(map[string]any) |
| 47 | } |
| 48 | for _, p := range plugins { |
| 49 | if p.Config == nil { |
| 50 | continue |
| 51 | } |
| 52 | |
| 53 | pc, err := config.Decode(ctx, p.URI(), p.Config) |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | config.Plugins[p.URI()] = pc |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | if config.Timeouts == nil { |
| 63 | config.Timeouts = make(map[string]string) |
| 64 | } |
| 65 | timeouts := timeout.All() |
| 66 | for k, v := range timeouts { |
| 67 | if config.Timeouts[k] == "" { |
| 68 | config.Timeouts[k] = v.String() |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // for the time being, keep the defaultConfig's version set at 1 so that |
| 73 | // when a config without a version is loaded from disk and has no version |
| 74 | // set, we assume it's a v1 config. But when generating new configs via |
| 75 | // this command, generate the max configuration version |
| 76 | config.Version = version.ConfigVersion |
| 77 | |
| 78 | return toml.NewEncoder(os.Stdout).SetIndentTables(true).Encode(config) |
| 79 | } |
| 80 | |
| 81 | func defaultConfig() *srvconfig.Config { |
| 82 | return platformAgnosticDefaultConfig() |
no test coverage detected
searching dependent graphs…