mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 03:13:11 -06:00
Fall back to postgres when parsing the database connection string for a URI schema fails
This commit is contained in:
parent
f7faf74528
commit
feef9c124c
|
|
@ -16,7 +16,6 @@ package keydb
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"github.com/matrix-org/dendrite/common/keydb/postgres"
|
||||
|
|
@ -39,6 +38,8 @@ func NewDatabase(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.NewDatabase(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.NewDatabase(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
|
|
@ -40,6 +39,8 @@ func NewDatabase(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.NewDatabase(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.NewDatabase(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"github.com/matrix-org/dendrite/mediaapi/storage/postgres"
|
||||
|
|
@ -42,6 +41,8 @@ func Open(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.Open(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.Open(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
|
|
@ -45,6 +44,8 @@ func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
|
@ -67,6 +66,8 @@ func Open(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.Open(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.Open(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
|
|
@ -58,6 +57,8 @@ func NewSyncServerDatasource(dataSourceName string) (Database, error) {
|
|||
case "postgres":
|
||||
return postgres.NewSyncServerDatasource(dataSourceName)
|
||||
default:
|
||||
return nil, errors.New("unknown schema")
|
||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
||||
// postgres key=value connection strings
|
||||
return postgres.NewSyncServerDatasource(dataSourceName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue