From 00adaed6a876186f16cbc617acf1ac7ed8914282 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Tue, 29 Oct 2024 06:50:14 -0500 Subject: [PATCH] add prod mode --- core.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core.go b/core.go index a2c8a2a..d449635 100644 --- a/core.go +++ b/core.go @@ -36,6 +36,7 @@ var cacheC CacheConfig var db *gorm.DB var mailer *Mailer var basePath string +var runMode string var disableEvents bool = false //go:embed all:template @@ -107,11 +108,13 @@ func (app *App) Run(router *httprouter.Router) { } useHttps, _ := strconv.ParseBool(useHttpsStr) - fmt.Printf("Welcome to Goffee\n") - if useHttps { - fmt.Printf("Listening on https \nWaiting for requests...\n") - } else { - fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber) + if runMode == "dev" { + fmt.Printf("Welcome to Goffee\n") + if useHttps { + fmt.Printf("Listening on https \nWaiting for requests...\n") + } else { + fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber) + } } // check if use letsencrypt @@ -177,7 +180,7 @@ func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httpr } } - // check if use letsencrypt + // check if enable core services UseCoreServicesStr := os.Getenv("App_USE_CORESERVICES") if UseCoreServicesStr == "" { UseCoreServicesStr = "false" @@ -571,6 +574,10 @@ func (app *App) SetBasePath(path string) { basePath = path } +func (app *App) SetRunMode(runmode string) { + runMode = runmode +} + func DisableEvents() { disableEvents = true }