summaryrefslogtreecommitdiffstats
path: root/gateway/router.go
diff options
context:
space:
mode:
authorDuco van Amstel <duco.vanamstel@gmail.com>2018-11-13 22:30:56 +0000
committerWim <wim@42.be>2018-11-13 23:30:56 +0100
commit16d5aeac7c2de010d30cddc90c5755ac5b989b2b (patch)
tree9d95ee605be7d287e49212053ac19f88842133a8 /gateway/router.go
parente19ba5a06ad94c389df1b253d30c9ba6e4d14273 (diff)
downloadmatterbridge-msglm-16d5aeac7c2de010d30cddc90c5755ac5b989b2b.tar.gz
matterbridge-msglm-16d5aeac7c2de010d30cddc90c5755ac5b989b2b.tar.bz2
matterbridge-msglm-16d5aeac7c2de010d30cddc90c5755ac5b989b2b.zip
Make config.Config more unit-test friendly (#586)
Diffstat (limited to 'gateway/router.go')
-rw-r--r--gateway/router.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/gateway/router.go b/gateway/router.go
index 030b7b1e..a6c6dafb 100644
--- a/gateway/router.go
+++ b/gateway/router.go
@@ -2,27 +2,32 @@ package gateway
import (
"fmt"
+ "time"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
samechannelgateway "github.com/42wim/matterbridge/gateway/samechannel"
- // "github.com/davecgh/go-spew/spew"
- "time"
)
type Router struct {
+ config.Config
+
Gateways map[string]*Gateway
Message chan config.Message
MattermostPlugin chan config.Message
- *config.Config
}
-func NewRouter(cfg *config.Config) (*Router, error) {
- r := &Router{Message: make(chan config.Message), MattermostPlugin: make(chan config.Message), Gateways: make(map[string]*Gateway), Config: cfg}
+func NewRouter(cfg config.Config) (*Router, error) {
+ r := &Router{
+ Config: cfg,
+ Message: make(chan config.Message),
+ MattermostPlugin: make(chan config.Message),
+ Gateways: make(map[string]*Gateway),
+ }
sgw := samechannelgateway.New(cfg)
gwconfigs := sgw.GetConfig()
- for _, entry := range append(gwconfigs, cfg.Gateway...) {
+ for _, entry := range append(gwconfigs, cfg.ConfigValues().Gateway...) {
if !entry.Enable {
continue
}