Procházet zdrojové kódy

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 7d574f5ac635d5bee56cc53ba556165a9000df15)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn před 2 roky
rodič
revize
9b383dbd51
1 změnil soubory, kde provedl 6 přidání a 11 odebrání
  1. 6 11
      libnetwork/config/config.go

+ 6 - 11
libnetwork/config/config.go

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