Skip to content

Commit 8ceb1fd

Browse files
committed
Add a way to disable providers in the configfile
1 parent e8f6ae7 commit 8ceb1fd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

doc/content/documentation/host_discovery.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ As you can see, the name of a provider section foes not imply which provider is
5858
specify the. As a result of this, you can easily use multiple instances of the same provider type,
5959
and can wrap a provider in a cache provider without affecting other parts of the configuration.
6060
61+
If you want to temporarily disable a provider in your configuration, you can add `enabled: false` to
62+
its parameters.
63+
6164
# Host attributes
6265

6366
Providers do not just return a list of host names. The power of Herd is that it can filter by any

registry.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ func (r *Registry) LoadProviders(c *viper.Viper) error {
133133
for key := range c.AllSettings() {
134134
ps := c.Sub(key)
135135
pname := ps.GetString("Provider")
136+
if ps.IsSet("Enabled") && !ps.GetBool("Enabled") {
137+
logrus.Debugf("Skipping disabled provider %s", key)
138+
continue
139+
}
136140
p, err := NewProvider(pname, key)
137141
if err != nil {
138142
rerr.Add(fmt.Errorf("Error parsing config for %s: %s", key, err))

0 commit comments

Comments
 (0)