summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-02-27 21:58:44 +0100
committerWim <wim@42.be>2018-02-27 23:22:12 +0100
commit2110db6f0ca65b5f0cfb4c520110e8d667fb105e (patch)
tree3a07c65759da8285924bb8f53668be05c35e1ea2
parent2bac8673829516d8314c459133e85a8c0cc1959c (diff)
downloadmatterbridge-msglm-2110db6f0ca65b5f0cfb4c520110e8d667fb105e.tar.gz
matterbridge-msglm-2110db6f0ca65b5f0cfb4c520110e8d667fb105e.tar.bz2
matterbridge-msglm-2110db6f0ca65b5f0cfb4c520110e8d667fb105e.zip
Add environment override back
-rw-r--r--bridge/config/config.go4
-rw-r--r--gateway/gateway.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 2a596cce..9e3f854e 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -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))
}
}
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 581b638b..5b14d164 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -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)