diff options
| author | Fabian Montero <fabian@posixlycorrect.com> | 2026-02-03 15:12:59 -0600 |
|---|---|---|
| committer | Fabian Montero <fabian@posixlycorrect.com> | 2026-02-03 15:12:59 -0600 |
| commit | 4a822c48da5a3aa4550fd0fad2697fd023c1810a (patch) | |
| tree | 3ad3d1fc31c545daf0d1c221c5cefba83c6cea04 /pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch | |
| parent | e44c6337d4557c9377b562e3687d24ef5e236974 (diff) | |
| parent | 0f6a8aa22d9b554c211a9d77bbf4fefdcabc20d1 (diff) | |
Merge commit '974154ce2da0b60bdff5ae3c57e0490db58d9f0e'
Diffstat (limited to 'pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch')
| -rw-r--r-- | pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch b/pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch new file mode 100644 index 0000000..69dc660 --- /dev/null +++ b/pkgs/socialpredict/0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch @@ -0,0 +1,30 @@ +From 67cf25f7cb397d37d807797b6013447b19c8f73b Mon Sep 17 00:00:00 2001 +From: Alejandro Soto <alejandro@34project.org> +Date: Thu, 29 Jan 2026 23:21:21 -0600 +Subject: [PATCH] Support POSTGRES_URL for overriding the PG DSN + +--- + backend/util/postgres.go | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/util/postgres.go b/util/postgres.go +index ac69932..030f516 100644 +--- a/util/postgres.go ++++ b/util/postgres.go +@@ -49,8 +49,11 @@ func InitDB() { + dbPort = "5432" + } + +- dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=UTC", +- dbHost, dbUser, dbPassword, dbName, dbPort) ++ dsn := os.Getenv("POSTGRES_URL") ++ if dsn == "" { ++ dsn = fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=UTC", ++ dbHost, dbUser, dbPassword, dbName, dbPort) ++ } + + DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{}) + if err != nil { +-- +2.51.2 + |
