add options for cdn and app

This commit is contained in:
Zeni Kim 2025-07-15 10:53:18 -05:00
parent c9cb539d18
commit 5f0ca8e797
4 changed files with 28 additions and 2 deletions

20
core.go
View file

@ -113,6 +113,26 @@ func (app *App) Run(router *httprouter.Router) {
router.ServeFiles("/public/*filepath", http.Dir("storage/public"))
}
// check if app engine is enable
AppEnableStr := os.Getenv("APP_ENABLE")
if "" == AppEnableStr {
AppEnableStr = "false"
}
AppEnable, _ := strconv.ParseBool(AppEnableStr)
if AppEnable {
router.ServeFiles("/app/*filepath", http.Dir("storage/app"))
}
// check if app engine is enable
CDNEnableStr := os.Getenv("CDN_ENABLE")
if "" == CDNEnableStr {
CDNEnableStr = "false"
}
CDNEnable, _ := strconv.ParseBool(CDNEnableStr)
if CDNEnable {
router.ServeFiles("/cdn/*filepath", http.Dir("storage/cdn"))
}
useHttpsStr := os.Getenv("App_USE_HTTPS")
if useHttpsStr == "" {
useHttpsStr = "false"