INNER CODE UNIT · Go
getAuthOpts
fluxcd/terraform-provider-flux · internal/provider/provider_resource_data.go:266
func getAuthOpts(g *Git) (*git.AuthOptions, error) {
u := g.Url.ValueURL()
switch u.Scheme {
case "http":
if g.Http == nil {
return nil, fmt.Errorf("git URL scheme is http but http configuration is empty")
}
return &git.AuthOptions{
Transport: git.HTTP,
Username: g.Http.Username.ValueString(),
Password: g.Http.Password.ValueString(),
}, nil
case "https":
if g.Http == nil {
return nil, fmt.Errorf("git URL scheme is https but http configuration is empty")
}
return &git.AuthOptions{
Transport: git.HTTPS,