forked from jshiffer/matterbridge
Add an option to skip the Mattermost server version check (#849)
Adds SkipVersionCheck bool option for mattermost
This commit is contained in:
parent
76c7b69e4e
commit
80b4cec87a
@ -127,6 +127,7 @@ type Protocol struct {
|
|||||||
ShowUserTyping bool // slack
|
ShowUserTyping bool // slack
|
||||||
ShowEmbeds bool // discord
|
ShowEmbeds bool // discord
|
||||||
SkipTLSVerify bool // IRC, mattermost
|
SkipTLSVerify bool // IRC, mattermost
|
||||||
|
SkipVersionCheck bool // mattermost
|
||||||
StripNick bool // all protocols
|
StripNick bool // all protocols
|
||||||
SyncTopic bool // slack
|
SyncTopic bool // slack
|
||||||
TengoModifyMessage string // general
|
TengoModifyMessage string // general
|
||||||
|
@ -70,6 +70,7 @@ func (b *Bmattermost) apiLogin() error {
|
|||||||
b.mc.SetLogLevel("debug")
|
b.mc.SetLogLevel("debug")
|
||||||
}
|
}
|
||||||
b.mc.SkipTLSVerify = b.GetBool("SkipTLSVerify")
|
b.mc.SkipTLSVerify = b.GetBool("SkipTLSVerify")
|
||||||
|
b.mc.SkipVersionCheck = b.GetBool("SkipVersionCheck")
|
||||||
b.mc.NoTLS = b.GetBool("NoTLS")
|
b.mc.NoTLS = b.GetBool("NoTLS")
|
||||||
b.Log.Infof("Connecting %s (team: %s) on %s", b.GetString("Login"), b.GetString("Team"), b.GetString("Server"))
|
b.Log.Infof("Connecting %s (team: %s) on %s", b.GetString("Login"), b.GetString("Team"), b.GetString("Server"))
|
||||||
err := b.mc.Login()
|
err := b.mc.Login()
|
||||||
|
@ -186,9 +186,10 @@ func (m *MMClient) serverAlive(firstConnection bool, b *backoff.Backoff) error {
|
|||||||
if resp.Error != nil {
|
if resp.Error != nil {
|
||||||
return fmt.Errorf("%#v", resp.Error.Error())
|
return fmt.Errorf("%#v", resp.Error.Error())
|
||||||
}
|
}
|
||||||
if firstConnection && !supportedVersion(resp.ServerVersion) {
|
if firstConnection && !m.SkipVersionCheck && !supportedVersion(resp.ServerVersion) {
|
||||||
return fmt.Errorf("unsupported mattermost version: %s", resp.ServerVersion)
|
return fmt.Errorf("unsupported mattermost version: %s", resp.ServerVersion)
|
||||||
}
|
}
|
||||||
|
if !m.SkipVersionCheck {
|
||||||
m.ServerVersion = resp.ServerVersion
|
m.ServerVersion = resp.ServerVersion
|
||||||
if m.ServerVersion == "" {
|
if m.ServerVersion == "" {
|
||||||
m.logger.Debugf("Server not up yet, reconnecting in %s", d)
|
m.logger.Debugf("Server not up yet, reconnecting in %s", d)
|
||||||
@ -197,6 +198,9 @@ func (m *MMClient) serverAlive(firstConnection bool, b *backoff.Backoff) error {
|
|||||||
m.logger.Infof("Found version %s", m.ServerVersion)
|
m.logger.Infof("Found version %s", m.ServerVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ type Credentials struct {
|
|||||||
Server string
|
Server string
|
||||||
NoTLS bool
|
NoTLS bool
|
||||||
SkipTLSVerify bool
|
SkipTLSVerify bool
|
||||||
|
SkipVersionCheck bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user