mirror of
https://github.com/datarhei/core.git
synced 2025-10-16 13:00:37 +08:00
Fix using clusterfs for API fs operations
This commit is contained in:
@@ -25,7 +25,7 @@ type FSHandler struct {
|
||||
filesystems map[string]FSConfig
|
||||
}
|
||||
|
||||
// NewFS return a new FSHanlder type. You have to provide a filesystem to act on.
|
||||
// NewFS return a new FSHandler type. You have to provide a filesystem to act on.
|
||||
func NewFS(filesystems map[string]FSConfig) *FSHandler {
|
||||
return &FSHandler{
|
||||
filesystems: filesystems,
|
||||
|
@@ -160,6 +160,7 @@ type filesystem struct {
|
||||
fs.FS
|
||||
|
||||
handler *handler.FSHandler
|
||||
apihandler *handler.FSHandler
|
||||
middleware echo.MiddlewareFunc
|
||||
}
|
||||
|
||||
@@ -196,6 +197,8 @@ func NewServer(config Config) (Server, error) {
|
||||
|
||||
corsPrefixes[httpfs.Mountpoint] = config.Cors.Origins
|
||||
|
||||
apihttpfs := httpfs
|
||||
|
||||
if config.Cluster != nil {
|
||||
if httpfs.Filesystem.Type() == "disk" || httpfs.Filesystem.Type() == "mem" {
|
||||
httpfs.Filesystem = fs.NewClusterFS(httpfs.Filesystem.Name(), httpfs.Filesystem, config.Cluster.ProxyReader())
|
||||
@@ -205,6 +208,7 @@ func NewServer(config Config) (Server, error) {
|
||||
filesystem := &filesystem{
|
||||
FS: httpfs,
|
||||
handler: handler.NewFS(httpfs),
|
||||
apihandler: handler.NewFS(apihttpfs),
|
||||
}
|
||||
|
||||
if httpfs.Filesystem.Type() == "disk" {
|
||||
@@ -639,7 +643,7 @@ func (s *server) setRoutesV3(v3 *echo.Group) {
|
||||
fshandlers[fs.Name] = api.FSConfig{
|
||||
Type: fs.Filesystem.Type(),
|
||||
Mountpoint: fs.Mountpoint,
|
||||
Handler: fs.handler,
|
||||
Handler: fs.apihandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user