2019-01-05 22:44:33 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/asdine/storm"
|
2020-05-31 23:12:36 +00:00
|
|
|
|
2019-01-05 22:44:33 +00:00
|
|
|
"github.com/filebrowser/filebrowser/v2/settings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type settingsBackend struct {
|
|
|
|
db *storm.DB
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s settingsBackend) Get() (*settings.Settings, error) {
|
2020-05-31 23:12:36 +00:00
|
|
|
set := &settings.Settings{}
|
|
|
|
return set, get(s.db, "settings", set)
|
2019-01-05 22:44:33 +00:00
|
|
|
}
|
|
|
|
|
2020-05-31 23:12:36 +00:00
|
|
|
func (s settingsBackend) Save(set *settings.Settings) error {
|
|
|
|
return save(s.db, "settings", set)
|
2019-01-05 22:44:33 +00:00
|
|
|
}
|
2019-01-08 10:29:09 +00:00
|
|
|
|
|
|
|
func (s settingsBackend) GetServer() (*settings.Server, error) {
|
|
|
|
server := &settings.Server{}
|
|
|
|
return server, get(s.db, "server", server)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s settingsBackend) SaveServer(server *settings.Server) error {
|
|
|
|
return save(s.db, "server", server)
|
|
|
|
}
|