MCPcopy Index your code
hub / github.com/containerd/containerd / outputConfig

Function outputConfig

cmd/containerd/command/config.go:39–79  ·  view source on GitHub ↗
(ctx context.Context, config *srvconfig.Config)

Source from the content-addressed store, hash-verified

37)
38
39func 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
81func defaultConfig() *srvconfig.Config {
82 return platformAgnosticDefaultConfig()

Callers 2

config.goFile · 0.85
dumpConfigFunction · 0.85

Calls 4

LoadPluginsFunction · 0.92
AllFunction · 0.92
DecodeMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…