mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Close #207
Former-commit-id: e7a0fe724406f2284d872e1b49451e8c85924bf4 [formerly 3e0f7f027d117dcb825b326e880ffa05cd5a7ce6] [formerly 70ddacbae6288e5aac8cc9d5cbb250814fe07f7c [formerly 4bf34124a3
]]
Former-commit-id: d9118bd6c1689df00c53219d5910892ec68892de [formerly 1e191afcd6f7d73069b6fc79e9b7a5cdd14d2ecb]
Former-commit-id: d908f459e005c204ad8eb0ef58f2e782f9b4c942
This commit is contained in:
parent
1b0f67c0f6
commit
1be7d7d256
@ -20,6 +20,8 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var databases = map[string]*storm.DB{}
|
||||
|
||||
// Parse ...
|
||||
func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, error) {
|
||||
var (
|
||||
@ -190,7 +192,14 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
|
||||
u.Scope = scope
|
||||
u.FileSystem = fileutils.Dir(scope)
|
||||
|
||||
db, err := storm.Open(database)
|
||||
var db *storm.DB
|
||||
if stored, ok := databases[database]; ok {
|
||||
db = stored
|
||||
} else {
|
||||
db, err = storm.Open(database)
|
||||
databases[database] = db
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user