Update config.go - libpq handle env correctly, just passtrough with an "null" URLstring if url is none

This commit is contained in:
toinux 2023-05-14 17:06:40 +01:00 committed by GitHub
parent ff00fc5677
commit ddb01405df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'
}
}