Add environment variable to disable TLS verification

This commit is contained in:
Tulir Asokan 2018-05-23 01:05:56 +03:00
parent 1d44d3da1a
commit f4066e72c3

View File

@ -38,6 +38,7 @@ import (
"maunium.net/go/gomuks/lib/bfhtml" "maunium.net/go/gomuks/lib/bfhtml"
"maunium.net/go/gomuks/matrix/pushrules" "maunium.net/go/gomuks/matrix/pushrules"
"maunium.net/go/gomuks/matrix/rooms" "maunium.net/go/gomuks/matrix/rooms"
"crypto/tls"
) )
// Container is a wrapper for a gomatrix Client and some other stuff. // Container is a wrapper for a gomatrix Client and some other stuff.
@ -94,6 +95,13 @@ func (c *Container) InitClient() error {
return err return err
} }
allowInsecure := len(os.Getenv("GOMUKS_ALLOW_INSECURE_SERVER")) > 0
if allowInsecure {
c.client.Client = &http.Client{
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
}
}
c.stop = make(chan bool, 1) c.stop = make(chan bool, 1)
if len(accessToken) > 0 { if len(accessToken) > 0 {