mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 04:32:47 +00:00
Fall back to postgres when database connection string parsing fails (#842)
* Fall back to postgres when parsing the database connection string for a URI schema fails * Fix behaviour so that it really tries postgres when URL parsing fails and it complains about unknown schema if it succeeds
This commit is contained in:
parent
f7faf74528
commit
714959126b
6 changed files with 19 additions and 7 deletions
|
@ -61,7 +61,9 @@ type Database interface {
|
|||
func Open(dataSourceName string) (Database, error) {
|
||||
uri, err := url.Parse(dataSourceName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.Open(dataSourceName)
|
||||
}
|
||||
switch uri.Scheme {
|
||||
case "postgres":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue