Skip to content

Commit

Permalink
fix(database): allow postgres sslmode=require without root cert (#4972)
Browse files Browse the repository at this point in the history
* fix(database): allow postgres sslmode=require without root cert

* fix(database): allow postgres sslmode=require without root cert (fix)

Co-authored-by: Silvan <silvan.reusser@gmail.com>

---------

Co-authored-by: Silvan <silvan.reusser@gmail.com>
  • Loading branch information
tothandras and adlerhurst committed May 23, 2023
1 parent e2ee622 commit 8c92636
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions internal/database/postgres/config.go
Expand Up @@ -113,14 +113,6 @@ type SSL struct {
func (s *Config) checkSSL(user User) {
if user.SSL.Mode == sslDisabledMode || user.SSL.Mode == "" {
user.SSL = SSL{Mode: sslDisabledMode}
return
}
if user.SSL.RootCert == "" {
logging.WithFields(
"cert set", user.SSL.Cert != "",
"key set", user.SSL.Key != "",
"rootCert set", user.SSL.RootCert != "",
).Fatal("at least ssl root cert has to be set")
}
}

Expand Down Expand Up @@ -149,7 +141,9 @@ func (c Config) String(useAdmin bool) string {
fields = append(fields, "dbname=postgres")
}
if user.SSL.Mode != sslDisabledMode {
fields = append(fields, "sslrootcert="+user.SSL.RootCert)
if user.SSL.RootCert != "" {
fields = append(fields, "sslrootcert="+user.SSL.RootCert)
}
if user.SSL.Cert != "" {
fields = append(fields, "sslcert="+user.SSL.Cert)
}
Expand Down

1 comment on commit 8c92636

@vercel
Copy link

@vercel vercel bot commented on 8c92636 May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./

docs-zitadel.vercel.app
docs-git-main-zitadel.vercel.app
zitadel-docs.vercel.app

Please sign in to comment.