2019-01-05 22:44:33 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/asdine/storm"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/auth"
|
2019-01-05 23:01:16 +00:00
|
|
|
"github.com/filebrowser/filebrowser/v2/settings"
|
2019-01-05 22:44:33 +00:00
|
|
|
"github.com/filebrowser/filebrowser/v2/share"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/storage"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/users"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewStorage creates a storage.Storage based on Bolt DB.
|
|
|
|
func NewStorage(db *storm.DB) *storage.Storage {
|
|
|
|
users := users.NewStorage(usersBackend{db: db})
|
|
|
|
share := share.NewStorage(shareBackend{db: db})
|
2019-01-05 23:01:16 +00:00
|
|
|
settings := settings.NewStorage(settingsBackend{db: db})
|
2019-01-05 22:44:33 +00:00
|
|
|
auth := auth.NewStorage(authBackend{db: db}, users)
|
|
|
|
|
|
|
|
return &storage.Storage{
|
2019-01-05 23:01:16 +00:00
|
|
|
Auth: auth,
|
|
|
|
Users: users,
|
|
|
|
Share: share,
|
2019-01-05 22:44:33 +00:00
|
|
|
Settings: settings,
|
|
|
|
}
|
|
|
|
}
|