aboutsummaryrefslogtreecommitdiff
path: root/keyserver/storage/postgres/storage.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-05-03 16:35:06 +0100
committerGitHub <noreply@github.com>2022-05-03 16:35:06 +0100
commit4ad5f9c982fe5dc9e306a9269621ead8c31248cf (patch)
tree9eac975c1d7232b35ce4d0c7f658db3c2289f0ab /keyserver/storage/postgres/storage.go
parent979a551f1e2aeb9f3417df5e52a7279230b7a3ba (diff)
Global database connection pool (for monolith mode) (#2411)
* Allow monolith components to share a single database pool * Don't yell about missing connection strings * Rename field * Setup tweaks * Fix panic * Improve configuration checks * Update config * Fix lint errors * Update comments
Diffstat (limited to 'keyserver/storage/postgres/storage.go')
-rw-r--r--keyserver/storage/postgres/storage.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/keyserver/storage/postgres/storage.go b/keyserver/storage/postgres/storage.go
index d4c7e2cc..b8f70acf 100644
--- a/keyserver/storage/postgres/storage.go
+++ b/keyserver/storage/postgres/storage.go
@@ -18,13 +18,14 @@ import (
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/keyserver/storage/postgres/deltas"
"github.com/matrix-org/dendrite/keyserver/storage/shared"
+ "github.com/matrix-org/dendrite/setup/base"
"github.com/matrix-org/dendrite/setup/config"
)
// NewDatabase creates a new sync server database
-func NewDatabase(dbProperties *config.DatabaseOptions) (*shared.Database, error) {
+func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions) (*shared.Database, error) {
var err error
- db, err := sqlutil.Open(dbProperties)
+ db, writer, err := base.DatabaseConnection(dbProperties, sqlutil.NewDummyWriter())
if err != nil {
return nil, err
}
@@ -63,7 +64,7 @@ func NewDatabase(dbProperties *config.DatabaseOptions) (*shared.Database, error)
}
d := &shared.Database{
DB: db,
- Writer: sqlutil.NewDummyWriter(),
+ Writer: writer,
OneTimeKeysTable: otk,
DeviceKeysTable: dk,
KeyChangesTable: kc,