add prod mode
This commit is contained in:
parent
cd04230f29
commit
00adaed6a8
1 changed files with 13 additions and 6 deletions
19
core.go
19
core.go
|
@ -36,6 +36,7 @@ var cacheC CacheConfig
|
||||||
var db *gorm.DB
|
var db *gorm.DB
|
||||||
var mailer *Mailer
|
var mailer *Mailer
|
||||||
var basePath string
|
var basePath string
|
||||||
|
var runMode string
|
||||||
var disableEvents bool = false
|
var disableEvents bool = false
|
||||||
|
|
||||||
//go:embed all:template
|
//go:embed all:template
|
||||||
|
@ -107,11 +108,13 @@ func (app *App) Run(router *httprouter.Router) {
|
||||||
}
|
}
|
||||||
useHttps, _ := strconv.ParseBool(useHttpsStr)
|
useHttps, _ := strconv.ParseBool(useHttpsStr)
|
||||||
|
|
||||||
fmt.Printf("Welcome to Goffee\n")
|
if runMode == "dev" {
|
||||||
if useHttps {
|
fmt.Printf("Welcome to Goffee\n")
|
||||||
fmt.Printf("Listening on https \nWaiting for requests...\n")
|
if useHttps {
|
||||||
} else {
|
fmt.Printf("Listening on https \nWaiting for requests...\n")
|
||||||
fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber)
|
} else {
|
||||||
|
fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if use letsencrypt
|
// 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")
|
UseCoreServicesStr := os.Getenv("App_USE_CORESERVICES")
|
||||||
if UseCoreServicesStr == "" {
|
if UseCoreServicesStr == "" {
|
||||||
UseCoreServicesStr = "false"
|
UseCoreServicesStr = "false"
|
||||||
|
@ -571,6 +574,10 @@ func (app *App) SetBasePath(path string) {
|
||||||
basePath = path
|
basePath = path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (app *App) SetRunMode(runmode string) {
|
||||||
|
runMode = runmode
|
||||||
|
}
|
||||||
|
|
||||||
func DisableEvents() {
|
func DisableEvents() {
|
||||||
disableEvents = true
|
disableEvents = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue