mirror of
https://github.com/fluxcd/flux2.git
synced 2026-04-21 02:55:44 +00:00
Add caBundle to gogit provider config
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
parent
aed7341b34
commit
43c6a1531a
8 changed files with 47 additions and 13 deletions
|
|
@ -75,16 +75,6 @@ func WithRepositoryURL(url string) GitOption {
|
|||
return repositoryURLOption(url)
|
||||
}
|
||||
|
||||
func WithCABundle(b []byte) GitOption {
|
||||
return caBundleOption(b)
|
||||
}
|
||||
|
||||
type caBundleOption []byte
|
||||
|
||||
func (o caBundleOption) applyGit(b *PlainGitBootstrapper) {
|
||||
b.caBundle = o
|
||||
}
|
||||
|
||||
type repositoryURLOption string
|
||||
|
||||
func (o repositoryURLOption) applyGit(b *PlainGitBootstrapper) {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,20 @@ func (o authorOption) applyGitProvider(b *GitProviderBootstrapper) {
|
|||
o.applyGit(b.PlainGitBootstrapper)
|
||||
}
|
||||
|
||||
func WithCABundle(b []byte) Option {
|
||||
return caBundleOption(b)
|
||||
}
|
||||
|
||||
type caBundleOption []byte
|
||||
|
||||
func (o caBundleOption) applyGit(b *PlainGitBootstrapper) {
|
||||
b.caBundle = o
|
||||
}
|
||||
|
||||
func (o caBundleOption) applyGitProvider(b *GitProviderBootstrapper) {
|
||||
b.caBundle = o
|
||||
}
|
||||
|
||||
func WithCommitMessageAppendix(appendix string) Option {
|
||||
return commitMessageAppendixOption(appendix)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue