Skip to content

Commit

Permalink
Allow overwriting OpenStack CA bundle via env
Browse files Browse the repository at this point in the history
  • Loading branch information
timebertt committed Sep 10, 2024
1 parent bc05961 commit 9cfad81
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/openstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"net/http"
"os"
"strings"
"time"

Expand Down Expand Up @@ -254,7 +255,16 @@ func getProvider(
authInfo.ProjectID = *overwrite.ProjectID
}

// construct transport that trusts the configured CA bundle
var transport http.RoundTripper

// If OS_CACERT env var is set it takes precedence over the configuration.
// This is useful for running yawol-controller locally where the configured file name in the cloud-provider config
// might not match with the local environment.
if caFileEnv := os.Getenv("OS_CACERT"); caFileEnv != "" {
caFile = caFileEnv
}

if caFile != "" {
roots, err := certutil.NewPool(caFile)
if err != nil {
Expand Down

0 comments on commit 9cfad81

Please sign in to comment.