mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-10 04:12:29 +03:00
Save Storm DB in the DbPath configured
This commit is contained in:
parent
cead8906d6
commit
c9742181ff
@ -4,6 +4,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/cloudsonic/sonic-server/conf"
|
"github.com/cloudsonic/sonic-server/conf"
|
||||||
|
"github.com/cloudsonic/sonic-server/log"
|
||||||
"github.com/siddontang/ledisdb/config"
|
"github.com/siddontang/ledisdb/config"
|
||||||
"github.com/siddontang/ledisdb/ledis"
|
"github.com/siddontang/ledisdb/ledis"
|
||||||
)
|
)
|
||||||
@ -18,6 +19,7 @@ func Db() *ledis.DB {
|
|||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
config := config.NewConfigDefault()
|
config := config.NewConfigDefault()
|
||||||
config.DataDir = conf.Sonic.DbPath
|
config.DataDir = conf.Sonic.DbPath
|
||||||
|
log.Debug("Opening LedisDB from: " + conf.Sonic.DbPath)
|
||||||
l, _ := ledis.Open(config)
|
l, _ := ledis.Open(config)
|
||||||
instance, err := l.Select(0)
|
instance, err := l.Select(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package db_storm
|
package db_storm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/asdine/storm"
|
"github.com/asdine/storm"
|
||||||
|
"github.com/cloudsonic/sonic-server/conf"
|
||||||
|
"github.com/cloudsonic/sonic-server/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -13,7 +16,9 @@ var (
|
|||||||
|
|
||||||
func Db() *storm.DB {
|
func Db() *storm.DB {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
instance, err := storm.Open("./storm.db")
|
dbPath := path.Join(conf.Sonic.DbPath, "storm.db")
|
||||||
|
instance, err := storm.Open(dbPath)
|
||||||
|
log.Debug("Opening Storm DB from: " + dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user