From 09cc2f9d0e96190a509623f5f666c93f3c52268a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 23 Sep 2022 19:58:21 +0200 Subject: [PATCH] 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 --- libnetwork/config/config.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libnetwork/config/config.go b/libnetwork/config/config.go index 115c4e14fe..122241896b 100644 --- a/libnetwork/config/config.go +++ b/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 }