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:
parent
bed115e664
commit
9b383dbd51
1 changed files with 6 additions and 11 deletions
|
@ -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) != ""
|
||||
|
|
Loading…
Reference in a new issue