From 80b4cec87ae6fa85beac024e926069fcf904d347 Mon Sep 17 00:00:00 2001 From: Joona Hoikkala Date: Sun, 16 Jun 2019 17:23:50 +0300 Subject: Add an option to skip the Mattermost server version check (#849) Adds SkipVersionCheck bool option for mattermost --- matterclient/helpers.go | 16 ++++++++++------ matterclient/matterclient.go | 17 +++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'matterclient') diff --git a/matterclient/helpers.go b/matterclient/helpers.go index c3d33145..d5b1038a 100644 --- a/matterclient/helpers.go +++ b/matterclient/helpers.go @@ -186,15 +186,19 @@ func (m *MMClient) serverAlive(firstConnection bool, b *backoff.Backoff) error { if resp.Error != nil { 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) } - m.ServerVersion = resp.ServerVersion - if m.ServerVersion == "" { - m.logger.Debugf("Server not up yet, reconnecting in %s", d) - time.Sleep(d) + if !m.SkipVersionCheck { + m.ServerVersion = resp.ServerVersion + if m.ServerVersion == "" { + m.logger.Debugf("Server not up yet, reconnecting in %s", d) + time.Sleep(d) + } else { + m.logger.Infof("Found version %s", m.ServerVersion) + return nil + } } else { - m.logger.Infof("Found version %s", m.ServerVersion) return nil } } diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 66ffcca6..338f86d7 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -16,14 +16,15 @@ import ( ) type Credentials struct { - Login string - Team string - Pass string - Token string - CookieToken bool - Server string - NoTLS bool - SkipTLSVerify bool + Login string + Team string + Pass string + Token string + CookieToken bool + Server string + NoTLS bool + SkipTLSVerify bool + SkipVersionCheck bool } type Message struct { -- cgit v1.2.3