aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2020-05-25 15:29:49 +0100
committerKegan Dougal <kegan@matrix.org>2020-05-25 15:29:49 +0100
commit492af0f2ec3850d41dd02c9c512de8361d50d271 (patch)
tree19a3cc80face29bd164296f173c59e6ca018848c /internal
parent3c3e014901fd03ea46ff4c5dfa125c6aa148d5ca (diff)
Use Opaque in addition to Path to set naffka DB names
Diffstat (limited to 'internal')
-rw-r--r--internal/basecomponent/base.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/basecomponent/base.go b/internal/basecomponent/base.go
index 3781cea4..e86d9102 100644
--- a/internal/basecomponent/base.go
+++ b/internal/basecomponent/base.go
@@ -265,7 +265,15 @@ func setupNaffka(cfg *config.Dendrite) (sarama.Consumer, sarama.SyncProducer) {
uri, err := url.Parse(string(cfg.Database.Naffka))
if err != nil || uri.Scheme == "file" {
- db, err = sqlutil.Open(internal.SQLiteDriverName(), string(uri.Path), nil)
+ var cs string
+ if uri.Opaque != "" { // file:filename.db
+ cs = uri.Opaque
+ } else if uri.Path != "" { // file:///path/to/filename.db
+ cs = uri.Path
+ } else {
+ logrus.Panic("file uri has no filename")
+ }
+ db, err = sqlutil.Open(internal.SQLiteDriverName(), cs, nil)
if err != nil {
logrus.WithError(err).Panic("Failed to open naffka database")
}