mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-18 17:12:37 +01:00
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 != "" {
|
if res != "" {
|
||||||
fieldVal := protoStruct.Field(i)
|
fieldVal := protoStruct.Field(i)
|
||||||
if fieldVal.Kind() == reflect.String {
|
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))
|
fieldVal.Set(reflect.ValueOf(res))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,8 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
|
|||||||
br := gw.Router.getBridge(cfg.Account)
|
br := gw.Router.getBridge(cfg.Account)
|
||||||
if br == nil {
|
if br == nil {
|
||||||
br = bridge.New(cfg)
|
br = bridge.New(cfg)
|
||||||
|
// override config from environment
|
||||||
|
config.OverrideCfgFromEnv(gw.Config, br.Protocol, br.Name)
|
||||||
// set logging
|
// set logging
|
||||||
br.Log = log.WithFields(log.Fields{"prefix": "bridge"})
|
br.Log = log.WithFields(log.Fields{"prefix": "bridge"})
|
||||||
// get the protocol configuration (eg irc)
|
// get the protocol configuration (eg irc)
|
||||||
|
Loading…
Reference in New Issue
Block a user