mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Use Opaque in addition to Path to set naffka DB names
This commit is contained in:
parent
3c3e014901
commit
492af0f2ec
1 changed files with 9 additions and 1 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue