1
0
mirror of synced 2026-02-07 03:05:56 +00:00

Add caBundle to gogit provider config

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
Somtochi Onyekwere
2021-11-22 14:39:51 +01:00
parent aed7341b34
commit 43c6a1531a
8 changed files with 47 additions and 13 deletions

View File

@@ -39,6 +39,9 @@ func BuildGitProvider(config Config) (gitprovider.Client, error) {
if config.Hostname != "" {
opts = append(opts, gitprovider.WithDomain(config.Hostname))
}
if config.CaBundle != nil {
opts = append(opts, gitprovider.WithCustomCAPostChainTransportHook(config.CaBundle))
}
if client, err = github.NewClient(opts...); err != nil {
return nil, err
}
@@ -49,6 +52,9 @@ func BuildGitProvider(config Config) (gitprovider.Client, error) {
if config.Hostname != "" {
opts = append(opts, gitprovider.WithDomain(config.Hostname))
}
if config.CaBundle != nil {
opts = append(opts, gitprovider.WithCustomCAPostChainTransportHook(config.CaBundle))
}
if client, err = gitlab.NewClient(config.Token, "", opts...); err != nil {
return nil, err
}

View File

@@ -41,4 +41,7 @@ type Config struct {
// Token contains the token used to authenticate with the
// Provider.
Token string
// CABunle contains the CA bundle to use for the client.
CaBundle []byte
}