Add environment override back
This commit is contained in:
parent
2bac867382
commit
2110db6f0c
|
@ -225,7 +225,9 @@ func OverrideCfgFromEnv(cfg *Config, protocol string, account string) {
|
|||
if res != "" {
|
||||
fieldVal := protoStruct.Field(i)
|
||||
if fieldVal.Kind() == reflect.String {
|
||||
log.Printf("config: overriding %s from env with %s\n", key, res)
|
||||
log.WithFields(log.Fields{
|
||||
"prefix": "config",
|
||||
}).Infof("overriding %s from env with %s\n", key, res)
|
||||
fieldVal.Set(reflect.ValueOf(res))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
|
|||
br := gw.Router.getBridge(cfg.Account)
|
||||
if br == nil {
|
||||
br = bridge.New(cfg)
|
||||
// override config from environment
|
||||
config.OverrideCfgFromEnv(gw.Config, br.Protocol, br.Name)
|
||||
// set logging
|
||||
br.Log = log.WithFields(log.Fields{"prefix": "bridge"})
|
||||
// get the protocol configuration (eg irc)
|
||||
|
|
Loading…
Reference in New Issue