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>
This commit is contained in:
Sebastiaan van Stijn 2022-09-23 19:58:21 +02:00
parent 528428919e
commit 09cc2f9d0e
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 7 additions and 12 deletions

View File

@ -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
}