diff --git a/Makefile b/Makefile index d9054cbad..feb2f9b65 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,8 @@ BIN_PLATFORMS := $(DOCKER_PLATFORMS) OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS)) ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) -BASEIMAGE_PROD ?= postgres:15.1-alpine -BASEIMAGE_DBG ?= postgres:15.1 +BASEIMAGE_PROD ?= postgres:16.1-alpine +BASEIMAGE_DBG ?= postgres:16.1 IMAGE := $(REGISTRY)/$(BIN) VERSION_PROD := $(VERSION) diff --git a/pkg/util.go b/pkg/util.go index 90d3ecdfe..3887b01a5 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -19,6 +19,7 @@ package pkg import ( "context" "fmt" + "net/url" "os" "path/filepath" "strings" @@ -203,14 +204,26 @@ func (session *sessionWrapper) waitForDBReady(waitTimeout int32) error { } func getSSLMODE(appBinding *v1alpha1.AppBinding) (string, error) { - sslmodeString := appBinding.Spec.ClientConfig.Service.Query - if sslmodeString == "" { - return "", nil - } - temps := strings.Split(sslmodeString, "=") - if len(temps) != 2 { - return "", fmt.Errorf("the sslmode is not valid. please provide the valid template. the temlpate should be like this: sslmode=") + if appBinding.Spec.ClientConfig.Service != nil { + sslmodeString := appBinding.Spec.ClientConfig.Service.Query + if sslmodeString == "" { + return "", nil + } + temps := strings.Split(sslmodeString, "=") + if len(temps) != 2 { + return "", fmt.Errorf("the sslmode is not valid. please provide the valid template. the temlpate should be like this: sslmode=") + } + return strings.TrimSpace(temps[1]), nil + } else if appBinding.Spec.ClientConfig.URL != nil { + parsedURL, err := url.Parse(*appBinding.Spec.ClientConfig.URL) + if err != nil { + return "", err + } + queryParams := parsedURL.Query() + sslmode := queryParams.Get("sslmode") + klog.Infoln("SSLMODE: ", sslmode) + return sslmode, nil } - return strings.TrimSpace(temps[1]), nil + return "", nil }