mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
libnetwork/config: inline ProcessOptions
This method was only used in a single place; inlining it makes it
easier to see what's done.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7d574f5ac6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -70,15 +70,19 @@ func ParseConfig(tomlCfgFile string) (*Config, error) {
|
||||
|
||||
// ParseConfigOptions parses the configuration options and returns
|
||||
// a reference to the corresponding Config structure
|
||||
func ParseConfigOptions(cfgOptions ...Option) *Config {
|
||||
func ParseConfigOptions(opts ...Option) *Config {
|
||||
cfg := &Config{
|
||||
Daemon: DaemonCfg{
|
||||
DriverCfg: make(map[string]interface{}),
|
||||
},
|
||||
Scopes: make(map[string]*datastore.ScopeCfg),
|
||||
}
|
||||
for _, opt := range opts {
|
||||
if opt != nil {
|
||||
opt(cfg)
|
||||
}
|
||||
}
|
||||
|
||||
cfg.ProcessOptions(cfgOptions...)
|
||||
cfg.LoadDefaultScopes(cfg.Daemon.DataDir)
|
||||
|
||||
return cfg
|
||||
@@ -166,15 +170,6 @@ func OptionNetworkControlPlaneMTU(exp int) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// ProcessOptions processes options and stores it in config
|
||||
func (c *Config) ProcessOptions(options ...Option) {
|
||||
for _, opt := range options {
|
||||
if opt != nil {
|
||||
opt(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IsValidName validates configuration objects supported by libnetwork
|
||||
func IsValidName(name string) bool {
|
||||
return strings.TrimSpace(name) != ""
|
||||
|
||||
Reference in New Issue
Block a user