libnetwork/config: rename ParseConfigOptions() to New()

This function effectively is a constructor, so rename it to better describe
it's functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-09-26 19:20:55 +02:00
parent 09cc2f9d0e
commit 267108e113
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 4 additions and 5 deletions

View File

@ -34,9 +34,8 @@ type Config struct {
PluginGetter plugingetter.PluginGetter
}
// ParseConfigOptions parses the configuration options and returns
// a reference to the corresponding Config structure
func ParseConfigOptions(opts ...Option) *Config {
// New creates a new Config and initializes it with the given Options.
func New(opts ...Option) *Config {
cfg := &Config{
DriverCfg: make(map[string]interface{}),
Scopes: make(map[string]*datastore.ScopeCfg),

View File

@ -186,7 +186,7 @@ type initializer struct {
func New(cfgOptions ...config.Option) (NetworkController, error) {
c := &controller{
id: stringid.GenerateRandomID(),
cfg: config.ParseConfigOptions(cfgOptions...),
cfg: config.New(cfgOptions...),
sandboxes: sandboxTable{},
svcRecords: make(map[string]svcInfo),
serviceBindings: make(map[serviceKey]*service),
@ -447,7 +447,7 @@ func (c *controller) ReloadConfiguration(cfgOptions ...config.Option) error {
// For now we accept the configuration reload only as a mean to provide a global store config after boot.
// Refuse the configuration if it alters an existing datastore client configuration.
update := false
cfg := config.ParseConfigOptions(cfgOptions...)
cfg := config.New(cfgOptions...)
for s := range c.cfg.Scopes {
if _, ok := cfg.Scopes[s]; !ok {