mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
528428919e
commit
09cc2f9d0e
1 changed files with 7 additions and 12 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue