mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
7b58b1fbf6
* refactor
* updates
* add circle
* update circle
* fix circle
Former-commit-id: bdc8ecd8766e35f9ab7a9e8bd9dd62206bffb37b [formerly 0d28166061f5c8e573e916797abef67e33a83cf2] [formerly efd85c08040565ba75e06b3d7d7b16366d36325a [formerly 613a3f2811
]]
Former-commit-id: eca6ad66d686a6737d81dca5e00f1d46a75a217a [formerly a987246f7c0940e8812cb4d0c1b0514b708e8c44]
Former-commit-id: fd882cf0d2216dcfb035a703011eeb1a2f79da9f
27 lines
585 B
Go
27 lines
585 B
Go
package bolt
|
|
|
|
import (
|
|
"github.com/asdine/storm"
|
|
fm "github.com/filebrowser/filebrowser"
|
|
)
|
|
|
|
// ConfigStore is a configuration store.
|
|
type ConfigStore struct {
|
|
DB *storm.DB
|
|
}
|
|
|
|
// Get gets a configuration from the database to an interface.
|
|
func (c ConfigStore) Get(name string, to interface{}) error {
|
|
err := c.DB.Get("config", name, to)
|
|
if err == storm.ErrNotFound {
|
|
return fm.ErrNotExist
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// Save saves a configuration from an interface to the database.
|
|
func (c ConfigStore) Save(name string, from interface{}) error {
|
|
return c.DB.Set("config", name, from)
|
|
}
|