add prod mode

This commit is contained in:
Zeni Kim 2024-10-29 06:50:14 -05:00
parent cd04230f29
commit 00adaed6a8

View file

@ -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,12 +108,14 @@ func (app *App) Run(router *httprouter.Router) {
}
useHttps, _ := strconv.ParseBool(useHttpsStr)
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
UseLetsEncryptStr := os.Getenv("App_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
}