summaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
authorLibravatar John Winston <59228178+winston0410@users.noreply.github.com>2024-08-08 13:00:19 +0100
committerLibravatar GitHub <noreply@github.com>2024-08-08 14:00:19 +0200
commit94c615d417948011430adb2ba9f8f5b99b962250 (patch)
tree175dcd1297302a9275ba6f7b007beaa2ba41433e /internal/db
parent[feature] Use gifv type for short soundless mp4 videos (#3182) (diff)
downloadgotosocial-94c615d417948011430adb2ba9f8f5b99b962250.tar.xz
[feature] Add `db-postgres-connection-string` option (#3178)
* handle db-url * lint and add doc * add more doc * fix config test * return error * change name from db-url to db-postgres-connection-string
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/bundb/bundb.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go
index d5071d141..0e58cb7fb 100644
--- a/internal/db/bundb/bundb.go
+++ b/internal/db/bundb/bundb.go
@@ -396,6 +396,13 @@ func maxOpenConns() int {
// deriveBunDBPGOptions takes an application config and returns either a ready-to-use set of options
// with sensible defaults, or an error if it's not satisfied by the provided config.
func deriveBunDBPGOptions() (*pgx.ConnConfig, error) {
+ url := config.GetDbPostgresConnectionString()
+
+ // if database URL is defined, ignore other DB related configuration fields
+ if url != "" {
+ cfg, err := pgx.ParseConfig(url)
+ return cfg, err
+ }
// these are all optional, the db adapter figures out defaults
address := config.GetDbAddress()