From 3af05af60313411e076b0a846505be0bd8cf12b8 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sat, 18 Jul 2020 14:59:21 +0800 Subject: [PATCH] feat:In the development mode, the token timeout is adjusted to infinity(#169) --- pkg/jwtauth/jwtauth.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 7c206f88..9eb5bd43 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -288,6 +288,11 @@ func (mw *GinJWTMiddleware) MiddlewareInit() error { mw.Timeout = time.Duration(config2.JwtConfig.Timeout) * time.Second } + if config2.ApplicationConfig.Mode == "dev" { + // TODO: dev mode token过期时长 为 100 年 + mw.Timeout = time.Duration(8760100) * time.Hour + } + if mw.TimeFunc == nil { mw.TimeFunc = time.Now }