aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/postgres2/postgres2_store.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-08-03 09:43:33 -0700
committerGitHub <noreply@github.com>2025-08-03 09:43:33 -0700
commitd49b44f2a4a67e7a630f2d9248a2ce1819d10fc0 (patch)
tree5692217002ba6f416614b96ab30daa698c6460e4 /weed/filer/postgres2/postgres2_store.go
parent8c239523260e6d87c1e27a82850f532b95cb8637 (diff)
downloadseaweedfs-d49b44f2a4a67e7a630f2d9248a2ce1819d10fc0.tar.xz
seaweedfs-d49b44f2a4a67e7a630f2d9248a2ce1819d10fc0.zip
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>
Diffstat (limited to 'weed/filer/postgres2/postgres2_store.go')
-rw-r--r--weed/filer/postgres2/postgres2_store.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/weed/filer/postgres2/postgres2_store.go b/weed/filer/postgres2/postgres2_store.go
index 4f063ad19..135bd54c4 100644
--- a/weed/filer/postgres2/postgres2_store.go
+++ b/weed/filer/postgres2/postgres2_store.go
@@ -40,13 +40,17 @@ func (store *PostgresStore2) 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 *PostgresStore2) initialize(createTable, upsertQuery string, enableUpsert bool, user, password, hostname string, port int, database, schema, sslmode string, maxIdle, maxOpen, maxLifetimeSeconds int) (err error) {
+func (store *PostgresStore2) initialize(createTable, 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 = true
if !enableUpsert {
@@ -68,6 +72,18 @@ func (store *PostgresStore2) initialize(createTable, upsertQuery string, enableU
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
}