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:
Sebastiaan van Stijn 2022-09-23 19:22:56 +02:00
parent bed115e664
commit 9b383dbd51
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -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) != ""