Pārlūkot izejas kodu

libnetwork/config: inline LoadDefaultScopes()

This method was an exported method, but only used as part of ParseConfigOptions,
so inlining it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 gadi atpakaļ
vecāks
revīzija
09cc2f9d0e
1 mainītis faili ar 7 papildinājumiem un 12 dzēšanām
  1. 7 12
      libnetwork/config/config.go

+ 7 - 12
libnetwork/config/config.go

@@ -34,16 +34,6 @@ type Config struct {
 	PluginGetter           plugingetter.PluginGetter
 }
 
-// LoadDefaultScopes loads default scope configs for scopes which
-// doesn't have explicit user specified configs.
-func (c *Config) LoadDefaultScopes(dataDir string) {
-	for k, v := range datastore.DefaultScopes(dataDir) {
-		if _, ok := c.Scopes[k]; !ok {
-			c.Scopes[k] = v
-		}
-	}
-}
-
 // ParseConfigOptions parses the configuration options and returns
 // a reference to the corresponding Config structure
 func ParseConfigOptions(opts ...Option) *Config {
@@ -51,14 +41,19 @@ func ParseConfigOptions(opts ...Option) *Config {
 		DriverCfg: make(map[string]interface{}),
 		Scopes:    make(map[string]*datastore.ScopeCfg),
 	}
+
 	for _, opt := range opts {
 		if opt != nil {
 			opt(cfg)
 		}
 	}
 
-	cfg.LoadDefaultScopes(cfg.DataDir)
-
+	// load default scope configs which don't have explicit user specified configs.
+	for k, v := range datastore.DefaultScopes(cfg.DataDir) {
+		if _, ok := cfg.Scopes[k]; !ok {
+			cfg.Scopes[k] = v
+		}
+	}
 	return cfg
 }