diff --git a/common/keydb/keydb.go b/common/keydb/keydb.go index b9fa884e2..26d3a33b7 100644 --- a/common/keydb/keydb.go +++ b/common/keydb/keydb.go @@ -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) } } diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go index 8cffdbf1a..a632449e5 100644 --- a/federationsender/storage/storage.go +++ b/federationsender/storage/storage.go @@ -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) } } diff --git a/mediaapi/storage/storage.go b/mediaapi/storage/storage.go index 0f39c1d0c..3e9e4ef6e 100644 --- a/mediaapi/storage/storage.go +++ b/mediaapi/storage/storage.go @@ -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) } } diff --git a/publicroomsapi/storage/storage.go b/publicroomsapi/storage/storage.go index a6a39d523..7018507e9 100644 --- a/publicroomsapi/storage/storage.go +++ b/publicroomsapi/storage/storage.go @@ -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) } } diff --git a/roomserver/storage/storage.go b/roomserver/storage/storage.go index 325d96e99..8ad2dde84 100644 --- a/roomserver/storage/storage.go +++ b/roomserver/storage/storage.go @@ -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) } } diff --git a/syncapi/storage/storage.go b/syncapi/storage/storage.go index eedb42f0e..de9a6bef9 100644 --- a/syncapi/storage/storage.go +++ b/syncapi/storage/storage.go @@ -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) } }