Fix #842 - again...
parent
ee8e167844
commit
9e489845eb
|
@ -16,7 +16,6 @@ package keydb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common/keydb/postgres"
|
"github.com/matrix-org/dendrite/common/keydb/postgres"
|
||||||
|
@ -33,14 +32,12 @@ type Database interface {
|
||||||
func NewDatabase(dataSourceName string) (Database, error) {
|
func NewDatabase(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.NewDatabase(dataSourceName)
|
return postgres.NewDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.NewDatabase(dataSourceName)
|
return postgres.NewDatabase(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.NewDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common"
|
"github.com/matrix-org/dendrite/common"
|
||||||
|
@ -34,14 +33,12 @@ type Database interface {
|
||||||
func NewDatabase(dataSourceName string) (Database, error) {
|
func NewDatabase(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.NewDatabase(dataSourceName)
|
return postgres.NewDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.NewDatabase(dataSourceName)
|
return postgres.NewDatabase(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.NewDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/mediaapi/storage/postgres"
|
"github.com/matrix-org/dendrite/mediaapi/storage/postgres"
|
||||||
|
@ -36,14 +35,12 @@ type Database interface {
|
||||||
func Open(dataSourceName string) (Database, error) {
|
func Open(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.Open(dataSourceName)
|
return postgres.Open(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.Open(dataSourceName)
|
return postgres.Open(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.Open(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/common"
|
"github.com/matrix-org/dendrite/common"
|
||||||
|
@ -39,14 +38,12 @@ type Database interface {
|
||||||
func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
|
func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
|
@ -61,14 +60,12 @@ type Database interface {
|
||||||
func Open(dataSourceName string) (Database, error) {
|
func Open(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.Open(dataSourceName)
|
return postgres.Open(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.Open(dataSourceName)
|
return postgres.Open(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.Open(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -52,14 +51,12 @@ type Database interface {
|
||||||
func NewSyncServerDatasource(dataSourceName string) (Database, error) {
|
func NewSyncServerDatasource(dataSourceName string) (Database, error) {
|
||||||
uri, err := url.Parse(dataSourceName)
|
uri, err := url.Parse(dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the scheme doesn't match, fall back to postgres in case the config has
|
|
||||||
// postgres key=value connection strings
|
|
||||||
return postgres.NewSyncServerDatasource(dataSourceName)
|
return postgres.NewSyncServerDatasource(dataSourceName)
|
||||||
}
|
}
|
||||||
switch uri.Scheme {
|
switch uri.Scheme {
|
||||||
case "postgres":
|
case "postgres":
|
||||||
return postgres.NewSyncServerDatasource(dataSourceName)
|
return postgres.NewSyncServerDatasource(dataSourceName)
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown schema")
|
return postgres.NewSyncServerDatasource(dataSourceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue