1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: serve static file from local fs when on dev (fix #176)

This commit is contained in:
Ferdinand Mütsch
2021-04-16 12:24:19 +02:00
parent a9739a6db0
commit b9ea6530f9
4 changed files with 31 additions and 5 deletions

14
config/fs.go Normal file
View File

@ -0,0 +1,14 @@
package config
import (
"io/fs"
"os"
)
// ChooseFS returns a local (DirFS) file system when on 'dev' environment and the given go-embed file system otherwise
func ChooseFS(localDir string, embeddedFS fs.FS) fs.FS {
if Get().IsDev() {
return os.DirFS(localDir)
}
return embeddedFS
}