Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable tls verification #11

Open
guilhermelff opened this issue Mar 29, 2023 · 2 comments
Open

Disable tls verification #11

guilhermelff opened this issue Mar 29, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@guilhermelff
Copy link

How do I disable the tls verification?

I'm getting this error:

tls: failed to verify certificate: x509: certificate signed by unknown authority

@rbed23
Copy link

rbed23 commented May 31, 2023

@guilhermelff did you find a solution to this issue yet?

@rbed23
Copy link

rbed23 commented Jun 1, 2023

based on this issue within the imported go-gitlab repo, you can use a custom WithHTTPClient ClientOptionFunc (code) to set the SSL options you want.

Im not native to GoLang, but I believe it could look something like this (need to import "net/http" and "crypto/tls")...

func New(logger *log.Logger, gitlabToken string, gitlabBaseURL *url.URL, committerName, committerEmail string,
) (*App, error) {
    customTransport := &(*http.DefaultTransport.(*http.Transport)) // make shallow copy
    customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
    client := &http.Client{Transport: customTransport}

    gitlabClient, err := goGitlab.NewClient(gitlabToken, goGitlab.WithBaseURL(gitlabBaseURL.String()), **goGitlab.WithHttpClient(client)**)
    if err != nil {
        return nil, fmt.Errorf("create GitLab client: %w", err)
    }
...

@alexandear alexandear added the enhancement New feature or request label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants