summaryrefslogtreecommitdiff
path: root/plugins/reload/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/reload/plugin.go')
-rw-r--r--plugins/reload/plugin.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/reload/plugin.go b/plugins/reload/plugin.go
index 93760b8a..d76fb0a4 100644
--- a/plugins/reload/plugin.go
+++ b/plugins/reload/plugin.go
@@ -27,14 +27,18 @@ type Plugin struct {
// Init controller service
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, res resetter.Resetter) error {
const op = errors.Op("reload_plugin_init")
- s.cfg = &Config{}
- InitDefaults(s.cfg)
+ if !cfg.Has(PluginName) {
+ return errors.E(op, errors.Disabled)
+ }
+
err := cfg.UnmarshalKey(PluginName, &s.cfg)
if err != nil {
// disable plugin in case of error
return errors.E(op, errors.Disabled, err)
}
+ s.cfg.InitDefaults()
+
s.log = log
s.res = res
s.stopc = make(chan struct{}, 1)
@@ -101,7 +105,7 @@ func (s *Plugin) Serve() chan error {
}
}()
- // map with configs by services
+ // map with config by services
updated := make(map[string]ServiceConfig, len(s.cfg.Services))
go func() {