1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-06-14 22:25:03 +02:00

Allow disabling of certificate verification for WebDAV (#98)

This commit is contained in:
Frederik Ring
2022-04-20 14:16:59 +02:00
committed by GitHub
parent a654097e59
commit 94a1edc4ad
4 changed files with 21 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import (
"fmt"
"io"
"io/fs"
"net/http"
"os"
"path"
"path/filepath"
@ -146,6 +147,15 @@ func newScript() (*script, error) {
} else {
webdavClient := gowebdav.NewClient(s.c.WebdavUrl, s.c.WebdavUsername, s.c.WebdavPassword)
s.webdavClient = webdavClient
if s.c.WebdavUrlInsecure {
defaultTransport, ok := http.DefaultTransport.(*http.Transport)
if !ok {
return nil, errors.New("newScript: unexpected error when asserting type for http.DefaultTransport")
}
webdavTransport := defaultTransport.Clone()
webdavTransport.TLSClientConfig.InsecureSkipVerify = s.c.WebdavUrlInsecure
s.webdavClient.SetTransport(webdavTransport)
}
}
}