Update config.go to Support PostgresURL as ENV Var

This commit is contained in:
toinux 2023-05-14 16:18:34 +01:00 committed by GitHub
parent 64e5b1874b
commit ff00fc5677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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