Allow plugins to load environment variable (#1727)
* Allow plugins to load environment variable
This commit is contained in:
parent
f3317f78d5
commit
b06167a3fa
5 changed files with 5 additions and 1 deletions
|
@ -254,7 +254,7 @@ func (pb *PluginBroker) loadPlugins(path string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
data = []byte(os.ExpandEnv(string(data)))
|
||||
_, err = pluginClient.Configure(context.Background(), &protobufs.Config{Config: data})
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "while configuring %s", pc.Name)
|
||||
|
|
|
@ -79,6 +79,7 @@ func (n *EmailPlugin) Configure(ctx context.Context, config *protobufs.Config) (
|
|||
}
|
||||
|
||||
n.ConfigByName[d.Name] = d
|
||||
baseLogger.Debug(fmt.Sprintf("Email plugin '%s' use SMTP host '%s:%d'", d.Name, d.SMTPHost, d.SMTPPort))
|
||||
return &protobufs.Empty{}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ func (s *HTTPPlugin) Configure(ctx context.Context, config *protobufs.Config) (*
|
|||
d := PluginConfig{}
|
||||
err := yaml.Unmarshal(config.Config, &d)
|
||||
s.PluginConfigByName[d.Name] = d
|
||||
logger.Debug(fmt.Sprintf("HTTP plugin '%s' use URL '%s'", d.Name, d.URL))
|
||||
return &protobufs.Empty{}, err
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ func (n *Notify) Configure(ctx context.Context, config *protobufs.Config) (*prot
|
|||
return nil, err
|
||||
}
|
||||
n.ConfigByName[d.Name] = d
|
||||
logger.Debug(fmt.Sprintf("Slack plugin '%s' use URL '%s'", d.Name, d.Webhook))
|
||||
return &protobufs.Empty{}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ func (s *Splunk) Configure(ctx context.Context, config *protobufs.Config) (*prot
|
|||
d := PluginConfig{}
|
||||
err := yaml.Unmarshal(config.Config, &d)
|
||||
s.PluginConfigByName[d.Name] = d
|
||||
logger.Debug(fmt.Sprintf("Splunk plugin '%s' use URL '%s'", d.Name, d.URL))
|
||||
return &protobufs.Empty{}, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue