mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
* enhancement: allow ocis to provide custom web applications * enhancement: add an option to disable web apps * test: add default logger tests * test: add app loading tests * test: add asset server tests * enhancement: make use of dedicated app conf file and app asset paths * enhancement: adjust asset locations and deprecate WEB_ASSET_PATH * enhancement: get rid of default logger and use the service level logger instead * Apply suggestions from code review Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> * enhancement: use basename as app id * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use afero as fs abstraction * enhancement: simplify logo upload * enhancement: make use of introductionVersion field annotations --------- Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> Co-authored-by: Martin <github@diemattels.at>
38 lines
819 B
Go
38 lines
819 B
Go
package fsx
|
|
|
|
import (
|
|
"github.com/spf13/afero"
|
|
)
|
|
|
|
var (
|
|
// assert interfaces implemented
|
|
_ afero.Fs = (*FallbackFS)(nil)
|
|
_ FS = (*FallbackFS)(nil)
|
|
)
|
|
|
|
// FallbackFS is a filesystem that layers a primary filesystem on top of a secondary filesystem.
|
|
type FallbackFS struct {
|
|
FS
|
|
primary *BaseFS
|
|
secondary *BaseFS
|
|
}
|
|
|
|
// Primary returns the primary filesystem.
|
|
func (d *FallbackFS) Primary() *BaseFS {
|
|
return d.primary
|
|
}
|
|
|
|
// Secondary returns the secondary filesystem.
|
|
func (d *FallbackFS) Secondary() *BaseFS {
|
|
return d.secondary
|
|
}
|
|
|
|
// NewFallbackFS returns a new FallbackFS instance.
|
|
func NewFallbackFS(primary, secondary FS) *FallbackFS {
|
|
return &FallbackFS{
|
|
FS: FromAfero(afero.NewCopyOnWriteFs(secondary, primary)),
|
|
primary: &BaseFS{Fs: primary},
|
|
secondary: &BaseFS{Fs: secondary},
|
|
}
|
|
}
|