aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-01-09 17:18:19 +0000
committerNeil Alexander <neilalexander@users.noreply.github.com>2020-01-09 17:18:19 +0000
commit9e489845eb64636821c180bbf07ffe5e0bcf1ed6 (patch)
tree1a1517794bf10f1fbd427b21b9eae33f756ec7bb
parentee8e167844fd4d18175cba384996bd2e198f41e4 (diff)
Fix #842 - again...
-rw-r--r--common/keydb/keydb.go5
-rw-r--r--federationsender/storage/storage.go5
-rw-r--r--mediaapi/storage/storage.go5
-rw-r--r--publicroomsapi/storage/storage.go5
-rw-r--r--roomserver/storage/storage.go5
-rw-r--r--syncapi/storage/storage.go5
6 files changed, 6 insertions, 24 deletions
diff --git a/common/keydb/keydb.go b/common/keydb/keydb.go
index 04692e98..d6e59080 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"
@@ -33,14 +32,12 @@ type Database interface {
func NewDatabase(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.NewDatabase(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.NewDatabase(dataSourceName)
}
}
diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go
index 98877140..4ce151c7 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"
@@ -34,14 +33,12 @@ type Database interface {
func NewDatabase(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.NewDatabase(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.NewDatabase(dataSourceName)
}
}
diff --git a/mediaapi/storage/storage.go b/mediaapi/storage/storage.go
index ca9f69f8..2c7f937d 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"
@@ -36,14 +35,12 @@ type Database interface {
func Open(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.Open(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.Open(dataSourceName)
}
}
diff --git a/publicroomsapi/storage/storage.go b/publicroomsapi/storage/storage.go
index d611686b..a6e18fbc 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"
@@ -39,14 +38,12 @@ type Database interface {
func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.NewPublicRoomsServerDatabase(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.NewPublicRoomsServerDatabase(dataSourceName)
}
}
diff --git a/roomserver/storage/storage.go b/roomserver/storage/storage.go
index 62e8b64c..df08c124 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"
@@ -61,14 +60,12 @@ type Database interface {
func Open(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.Open(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.Open(dataSourceName)
}
}
diff --git a/syncapi/storage/storage.go b/syncapi/storage/storage.go
index 4d896531..586e630d 100644
--- a/syncapi/storage/storage.go
+++ b/syncapi/storage/storage.go
@@ -16,7 +16,6 @@ package storage
import (
"context"
- "errors"
"net/url"
"time"
@@ -52,14 +51,12 @@ type Database interface {
func NewSyncServerDatasource(dataSourceName string) (Database, error) {
uri, err := url.Parse(dataSourceName)
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)
}
switch uri.Scheme {
case "postgres":
return postgres.NewSyncServerDatasource(dataSourceName)
default:
- return nil, errors.New("unknown schema")
+ return postgres.NewSyncServerDatasource(dataSourceName)
}
}