aboutsummaryrefslogtreecommitdiff
path: root/mediaapi/storage/sqlite3/mediaapi.go
diff options
context:
space:
mode:
Diffstat (limited to 'mediaapi/storage/sqlite3/mediaapi.go')
-rw-r--r--mediaapi/storage/sqlite3/mediaapi.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/mediaapi/storage/sqlite3/mediaapi.go b/mediaapi/storage/sqlite3/mediaapi.go
index abf32936..c0ab10e9 100644
--- a/mediaapi/storage/sqlite3/mediaapi.go
+++ b/mediaapi/storage/sqlite3/mediaapi.go
@@ -19,12 +19,13 @@ import (
// Import the postgres database driver.
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/mediaapi/storage/shared"
+ "github.com/matrix-org/dendrite/setup/base"
"github.com/matrix-org/dendrite/setup/config"
)
// NewDatabase opens a SQLIte database.
-func NewDatabase(dbProperties *config.DatabaseOptions) (*shared.Database, error) {
- db, err := sqlutil.Open(dbProperties)
+func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions) (*shared.Database, error) {
+ db, writer, err := base.DatabaseConnection(dbProperties, sqlutil.NewExclusiveWriter())
if err != nil {
return nil, err
}
@@ -40,6 +41,6 @@ func NewDatabase(dbProperties *config.DatabaseOptions) (*shared.Database, error)
MediaRepository: mediaRepo,
Thumbnails: thumbnails,
DB: db,
- Writer: sqlutil.NewExclusiveWriter(),
+ Writer: writer,
}, nil
}