Simplify resources.FS

This commit is contained in:
Deluan 2024-05-16 22:53:51 -04:00
parent 7f52ff72dc
commit a7a4fb522c

View file

@ -11,19 +11,12 @@ import (
"github.com/navidrome/navidrome/utils/merge" "github.com/navidrome/navidrome/utils/merge"
) )
var ( //go:embed *
//go:embed * var embedFS embed.FS
embedFS embed.FS
fsOnce sync.Once
fsys fs.FS
)
func FS() fs.FS { var FS = sync.OnceValue(func() fs.FS {
fsOnce.Do(func() { return merge.FS{
fsys = merge.FS{ Base: embedFS,
Base: embedFS, Overlay: os.DirFS(path.Join(conf.Server.DataFolder, "resources")),
Overlay: os.DirFS(path.Join(conf.Server.DataFolder, "resources")), }
} })
})
return fsys
}