cmd/containerd: deduplicate config*.go
`config_linux.go` and `config_windows.go` are identical. `config_unsupported.go` is also almost identical but enables debug logs by default. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
9a7ca39cbd
commit
ac2726e12c
@ -22,6 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/containerd/containerd/defaults"
|
||||||
"github.com/containerd/containerd/pkg/timeout"
|
"github.com/containerd/containerd/pkg/timeout"
|
||||||
"github.com/containerd/containerd/services/server"
|
"github.com/containerd/containerd/services/server"
|
||||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||||
@ -113,3 +114,18 @@ var configCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func platformAgnosticDefaultConfig() *srvconfig.Config {
|
||||||
|
return &srvconfig.Config{
|
||||||
|
Version: 1,
|
||||||
|
Root: defaults.DefaultRootDir,
|
||||||
|
State: defaults.DefaultStateDir,
|
||||||
|
GRPC: srvconfig.GRPCConfig{
|
||||||
|
Address: defaults.DefaultAddress,
|
||||||
|
MaxRecvMsgSize: defaults.DefaultMaxRecvMsgSize,
|
||||||
|
MaxSendMsgSize: defaults.DefaultMaxSendMsgSize,
|
||||||
|
},
|
||||||
|
DisabledPlugins: []string{},
|
||||||
|
RequiredPlugins: []string{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,21 +17,9 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/defaults"
|
|
||||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultConfig() *srvconfig.Config {
|
func defaultConfig() *srvconfig.Config {
|
||||||
return &srvconfig.Config{
|
return platformAgnosticDefaultConfig()
|
||||||
Version: 1,
|
|
||||||
Root: defaults.DefaultRootDir,
|
|
||||||
State: defaults.DefaultStateDir,
|
|
||||||
GRPC: srvconfig.GRPCConfig{
|
|
||||||
Address: defaults.DefaultAddress,
|
|
||||||
MaxRecvMsgSize: defaults.DefaultMaxRecvMsgSize,
|
|
||||||
MaxSendMsgSize: defaults.DefaultMaxSendMsgSize,
|
|
||||||
},
|
|
||||||
DisabledPlugins: []string{},
|
|
||||||
RequiredPlugins: []string{},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func defaultConfig() *srvconfig.Config {
|
func defaultConfig() *srvconfig.Config {
|
||||||
return &srvconfig.Config{
|
cfg := platformAgnosticDefaultConfig()
|
||||||
Version: 1,
|
cfg.Debug = srvconfig.Debug{
|
||||||
Root: defaults.DefaultRootDir,
|
|
||||||
State: defaults.DefaultStateDir,
|
|
||||||
GRPC: srvconfig.GRPCConfig{
|
|
||||||
Address: defaults.DefaultAddress,
|
|
||||||
},
|
|
||||||
Debug: srvconfig.Debug{
|
|
||||||
Level: "info",
|
Level: "info",
|
||||||
Address: defaults.DefaultDebugAddress,
|
Address: defaults.DefaultDebugAddress,
|
||||||
},
|
|
||||||
DisabledPlugins: []string{},
|
|
||||||
RequiredPlugins: []string{},
|
|
||||||
}
|
}
|
||||||
|
return cfg
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,9 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/defaults"
|
|
||||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultConfig() *srvconfig.Config {
|
func defaultConfig() *srvconfig.Config {
|
||||||
return &srvconfig.Config{
|
return platformAgnosticDefaultConfig()
|
||||||
Version: 1,
|
|
||||||
Root: defaults.DefaultRootDir,
|
|
||||||
State: defaults.DefaultStateDir,
|
|
||||||
GRPC: srvconfig.GRPCConfig{
|
|
||||||
Address: defaults.DefaultAddress,
|
|
||||||
MaxRecvMsgSize: defaults.DefaultMaxRecvMsgSize,
|
|
||||||
MaxSendMsgSize: defaults.DefaultMaxSendMsgSize,
|
|
||||||
},
|
|
||||||
DisabledPlugins: []string{},
|
|
||||||
RequiredPlugins: []string{},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user