mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 00:15:11 +01:00
feature (canary): toggle for canary release
This commit is contained in:
parent
87c41adfe7
commit
f0895fc483
2 changed files with 19 additions and 5 deletions
3
Makefile
3
Makefile
|
|
@ -9,6 +9,9 @@ build_init:
|
|||
|
||||
build_frontend:
|
||||
NODE_ENV=production npm run build
|
||||
mkdir -p ./server/ctrl/static/www/canary/
|
||||
cp -R ./public/assets ./server/ctrl/static/www/canary/
|
||||
cp -R ./public/*.html ./server/ctrl/static/www/canary/
|
||||
|
||||
build_backend:
|
||||
CGO_ENABLED=1 go build --tags "fts5" -o dist/filestash cmd/main.go
|
||||
|
|
|
|||
|
|
@ -98,11 +98,22 @@ func LegacyServeFile(res http.ResponseWriter, req *http.Request, filePath string
|
|||
continue
|
||||
}
|
||||
curPath := filePath + cfg.FileExt
|
||||
file, err := WWWEmbed.Open("static/www" + curPath)
|
||||
if env := os.Getenv("DEBUG"); env == "true" {
|
||||
file, err = WWWDir.Open("server/ctrl/static/www" + curPath)
|
||||
} else if os.Getenv("CANARY") != "" {
|
||||
file, err = WWWDir.Open("public" + curPath)
|
||||
var (
|
||||
file fs.File
|
||||
err error
|
||||
)
|
||||
if os.Getenv("CANARY") == "true" { // TODO: remove legacy option
|
||||
if env := os.Getenv("DEBUG"); env == "true" {
|
||||
file, err = WWWDir.Open("public" + curPath)
|
||||
} else {
|
||||
file, err = WWWEmbed.Open("static/www/canary" + curPath)
|
||||
}
|
||||
} else {
|
||||
if env := os.Getenv("DEBUG"); env == "true" {
|
||||
file, err = WWWDir.Open("server/ctrl/static/www" + curPath)
|
||||
} else {
|
||||
file, err = WWWEmbed.Open("static/www" + curPath)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue