Skip to content

Commit 8ab707a

Browse files
authored
Merge pull request #788 from bmeneg/fix-customCA
internal/gitlab: fix init with custom CA file
2 parents bf0989c + 99902d1 commit 8ab707a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

internal/gitlab/gitlab.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func UserID() (int, error) {
7070

7171
// Init initializes a gitlab client for use throughout lab.
7272
func Init(_host, _user, _token string, allowInsecure bool) {
73-
if len(_host) > 0 && _host[len(_host)-1:][0] == '/' {
74-
_host = _host[0 : len(_host)-1]
73+
if len(_host) > 0 && _host[len(_host)-1] == '/' {
74+
_host = _host[:len(_host)-1]
7575
}
7676
host = _host
7777
user = _user
@@ -103,6 +103,13 @@ func Init(_host, _user, _token string, allowInsecure bool) {
103103
// one for instance) instead of relying only on those installed in the current
104104
// system database
105105
func InitWithCustomCA(_host, _user, _token, caFile string) error {
106+
if len(_host) > 0 && _host[len(_host)-1] == '/' {
107+
_host = _host[:len(_host)-1]
108+
}
109+
host = _host
110+
user = _user
111+
token = _token
112+
106113
caCert, err := ioutil.ReadFile(caFile)
107114
if err != nil {
108115
return err

0 commit comments

Comments
 (0)