From d49b44f2a4a67e7a630f2d9248a2ce1819d10fc0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 3 Aug 2025 09:43:33 -0700 Subject: Postgres (CockroachDB) with full certificate verification (#7076) * Postgres (CockroachDB) with full certificate verification * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove duplicated comments --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- weed/filer/postgres/postgres_store.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'weed/filer/postgres/postgres_store.go') diff --git a/weed/filer/postgres/postgres_store.go b/weed/filer/postgres/postgres_store.go index 0c02f0726..568096b0b 100644 --- a/weed/filer/postgres/postgres_store.go +++ b/weed/filer/postgres/postgres_store.go @@ -35,13 +35,17 @@ func (store *PostgresStore) Initialize(configuration util.Configuration, prefix configuration.GetString(prefix+"database"), configuration.GetString(prefix+"schema"), configuration.GetString(prefix+"sslmode"), + configuration.GetString(prefix+"sslcert"), + configuration.GetString(prefix+"sslkey"), + configuration.GetString(prefix+"sslrootcert"), + configuration.GetString(prefix+"sslcrl"), configuration.GetInt(prefix+"connection_max_idle"), configuration.GetInt(prefix+"connection_max_open"), configuration.GetInt(prefix+"connection_max_lifetime_seconds"), ) } -func (store *PostgresStore) initialize(upsertQuery string, enableUpsert bool, user, password, hostname string, port int, database, schema, sslmode string, maxIdle, maxOpen, maxLifetimeSeconds int) (err error) { +func (store *PostgresStore) initialize(upsertQuery string, enableUpsert bool, user, password, hostname string, port int, database, schema, sslmode, sslcert, sslkey, sslrootcert, sslcrl string, maxIdle, maxOpen, maxLifetimeSeconds int) (err error) { store.SupportBucketTable = false if !enableUpsert { @@ -63,6 +67,18 @@ func (store *PostgresStore) initialize(upsertQuery string, enableUpsert bool, us if sslmode != "" { sqlUrl += " sslmode=" + sslmode } + if sslcert != "" { + sqlUrl += " sslcert=" + sslcert + } + if sslkey != "" { + sqlUrl += " sslkey=" + sslkey + } + if sslrootcert != "" { + sqlUrl += " sslrootcert=" + sslrootcert + } + if sslcrl != "" { + sqlUrl += " sslcrl=" + sslcrl + } if user != "" { sqlUrl += " user=" + user } -- cgit v1.2.3