Skip to content

Commit

Permalink
fix: debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
soxft committed Apr 24, 2022
1 parent 8e7ac6c commit ba058cf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
web:
Address: :8080 # 监听地址
Access-Control-Allow-Origin: "*"
Debug: true # 是否开启debug模式
Debug: false # 是否开启debug模式
redis:
Address: 127.0.0.1:6379 # redis地址
Password:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap/5.1.3/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap/5.1.3/js/bootstrap.bundle.min.js" type="application/javascript"></script>
<!-- 不蒜子 -->
<script src="./js" type="application/javascript"></script>
<script src="/js" type="application/javascript"></script>
<style>
a {
color: gray;
Expand Down
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func main() {
// init redis pool
redisHelper.Pool = redisHelper.NewPool()

// debug
if !config.C.Web.Debug {
gin.SetMode(gin.ReleaseMode)
}

r := gin.Default()
r.Use(gin.Logger())
r.Use(gin.Recovery())
Expand All @@ -28,10 +33,6 @@ func main() {
r.GET("/ping", web.PingHandler)
r.NoRoute(web.NoRouteHandler)

// debug
if !config.C.Web.Debug {
gin.SetMode(gin.ReleaseMode)
}
// start server
err := r.Run(config.C.Web.Address)
if err != nil {
Expand Down

0 comments on commit ba058cf

Please sign in to comment.