fix: Set whether to enable debug mode

This commit is contained in:
2024-12-19 15:44:12 +08:00
parent 2fa6e78626
commit a646b3cb4f
2 changed files with 8 additions and 2 deletions

View File

@@ -46,10 +46,16 @@ func init() {
gin.SetMode(gin.ReleaseMode)
}
func (ma *MApp) Run() {
func (ma *MApp) Run(debug bool) {
ma.loadRoutes()
ma.loadTemplates()
if debug {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
addr := fmt.Sprintf("%s:%d", ma.Host, ma.Port)
log.Printf("app listening on %s\n", addr)
err := ma.engine.Run(addr)