From ff00fc5677a352593f4177f0ec66d33cbee1a51e Mon Sep 17 00:00:00 2001 From: toinux <26522723+itzwam@users.noreply.github.com> Date: Sun, 14 May 2023 16:18:34 +0100 Subject: [PATCH 1/3] Update config.go to Support PostgresURL as ENV Var --- pkg/config/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 96ccda9..69fa5fe 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -857,7 +857,10 @@ func LoadConfig(file string) (*Config, error) { parsedConfig.Section("postgres").MapTo(&psql) if server.StoreBackend == "postgres" { if psql.URL == "" { - return nil, ErrPostgresUnconfigured + psql.URL = os.Getenv("DATABASE_URL") + if psql.URL == "" { + return nil, ErrPostgresUnconfigured + } } } From ddb01405df3ac1ba22075f74748405899abe10bf Mon Sep 17 00:00:00 2001 From: toinux <26522723+itzwam@users.noreply.github.com> Date: Sun, 14 May 2023 17:06:40 +0100 Subject: [PATCH 2/3] Update config.go - libpq handle env correctly, just passtrough with an "null" URLstring if url is none --- pkg/config/config.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 69fa5fe..ffba093 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -857,10 +857,7 @@ func LoadConfig(file string) (*Config, error) { parsedConfig.Section("postgres").MapTo(&psql) if server.StoreBackend == "postgres" { if psql.URL == "" { - psql.URL = os.Getenv("DATABASE_URL") - if psql.URL == "" { - return nil, ErrPostgresUnconfigured - } + psql.URL = 'postgres:///?sslmode=prefer' } } From e8509f74d596bb6020f0beeda31f6b06dff396be Mon Sep 17 00:00:00 2001 From: toinux <26522723+itzwam@users.noreply.github.com> Date: Sun, 14 May 2023 17:13:04 +0100 Subject: [PATCH 3/3] WTF is that char --- pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index ffba093..bbf4b8f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -857,7 +857,7 @@ func LoadConfig(file string) (*Config, error) { parsedConfig.Section("postgres").MapTo(&psql) if server.StoreBackend == "postgres" { if psql.URL == "" { - psql.URL = 'postgres:///?sslmode=prefer' + psql.URL = "postgres:///?sslmode=prefer" } }