diff options
author | Wim <wim@42.be> | 2019-09-09 23:48:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-09 23:48:00 +0200 |
commit | 28783a4146361381e57419aa4bcf623f7ab7b80d (patch) | |
tree | c796df65d6b02e7151c4d4c7b6714b99df676171 /gateway/router.go | |
parent | f92927eae5b460e768f6cf5fb97e237640dfbd44 (diff) | |
download | matterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.tar.gz matterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.tar.bz2 matterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.zip |
Do configuration validation on start-up. Fixes #888 (#889)
Fail if:
* we don't have any gateways configured
* we have gateways configured but with non-existing bridge configuration
* we have gateways configured without any configuration
Diffstat (limited to 'gateway/router.go')
-rw-r--r-- | gateway/router.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gateway/router.go b/gateway/router.go index 3d531676..56573f74 100644 --- a/gateway/router.go +++ b/gateway/router.go @@ -59,8 +59,14 @@ func NewRouter(rootLogger *logrus.Logger, cfg config.Config, bridgeMap map[strin // between them. func (r *Router) Start() error { m := make(map[string]*bridge.Bridge) + if len(r.Gateways) == 0 { + return fmt.Errorf("no [[gateway]] configured. See https://github.com/42wim/matterbridge/wiki/How-to-create-your-config for more info") + } for _, gw := range r.Gateways { r.logger.Infof("Parsing gateway %s", gw.Name) + if len(gw.Bridges) == 0 { + return fmt.Errorf("no bridges configured for gateway %s. See https://github.com/42wim/matterbridge/wiki/How-to-create-your-config for more info", gw.Name) + } for _, br := range gw.Bridges { m[br.Account] = br } |