4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-06 23:34:03 +00:00

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
This commit is contained in:
Wim
2019-09-09 23:48:00 +02:00
committed by GitHub
parent f92927eae5
commit 28783a4146
4 changed files with 38 additions and 1 deletions

View File

@ -15,10 +15,15 @@ import (
var testconfig = []byte(`
[irc.freenode]
server=""
[mattermost.test]
server=""
[gitter.42wim]
server=""
[discord.test]
server=""
[slack.test]
server=""
[[gateway]]
name = "bridge1"
@ -44,10 +49,15 @@ var testconfig = []byte(`
var testconfig2 = []byte(`
[irc.freenode]
server=""
[mattermost.test]
server=""
[gitter.42wim]
server=""
[discord.test]
server=""
[slack.test]
server=""
[[gateway]]
name = "bridge1"
@ -87,8 +97,11 @@ var testconfig2 = []byte(`
var testconfig3 = []byte(`
[irc.zzz]
server=""
[telegram.zzz]
server=""
[slack.zzz]
server=""
[[gateway]]
name="bridge"
enable=true
@ -176,7 +189,6 @@ func TestNewRouter(t *testing.T) {
assert.Equal(t, 1, len(r.Gateways))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Bridges))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Channels))
r = maketestRouter(testconfig2)
assert.Equal(t, 2, len(r.Gateways))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Bridges))