diff --git a/core/commands/config.go b/core/commands/config.go index 82058d623f95..a017d92a07ee 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -326,11 +326,10 @@ Backing up the config before running this command is advised.`, cmds.StringArg("profile", true, false, "The profile to apply to the config."), }, Run: func(req cmds.Request, res cmds.Response) { - args := req.Arguments() - profile, ok := config.Profiles[args[0]] + profile, ok := config.Profiles[req.Arguments()[0]] if !ok { - res.SetError(fmt.Errorf("%s in not a profile", args[0]), cmds.ErrNormal) + res.SetError(fmt.Errorf("%s in not a profile", req.Arguments()[0]), cmds.ErrNormal) return } diff --git a/repo/config/profile.go b/repo/config/profile.go index 7711d9e7c4f6..526574f288e5 100644 --- a/repo/config/profile.go +++ b/repo/config/profile.go @@ -1,7 +1,9 @@ package config +// Transformer is a function which takes configuration and applies some filter to it type Transformer func(c *Config) error +// Profile applies some set of changes to the configuration type Profile struct { Apply Transformer Unapply Transformer @@ -32,6 +34,7 @@ var Profiles = map[string]*Profile{ "/ip4/240.0.0.0/ipcidr/4", } + c.Addresses.NoAnnounce = append(c.Addresses.NoAnnounce, defaultServerFilters...) c.Swarm.AddrFilters = append(c.Swarm.AddrFilters, defaultServerFilters...) c.Discovery.MDNS.Enabled = false return nil