Browse Source
Merge pull request #705 from songzhibin97/gva_gormv2_dev
fix: cache初始化时间问题
main
奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
8 deletions
-
server/core/viper.go
|
|
@ -7,8 +7,6 @@ import ( |
|
|
|
"path/filepath" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/service/system" |
|
|
|
|
|
|
|
"github.com/songzhibin97/gkit/cache/local_cache" |
|
|
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|
|
@ -51,7 +49,7 @@ func Viper(path ...string) *viper.Viper { |
|
|
|
|
|
|
|
v.OnConfigChange(func(e fsnotify.Event) { |
|
|
|
fmt.Println("config file changed:", e.Name) |
|
|
|
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil { |
|
|
|
if err = v.Unmarshal(&global.GVA_CONFIG); err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
}) |
|
|
@ -60,10 +58,6 @@ func Viper(path ...string) *viper.Viper { |
|
|
|
} |
|
|
|
global.GVA_CONFIG.AutoCode.Root, _ = filepath.Abs("..") |
|
|
|
global.BlackCache = local_cache.NewCache( |
|
|
|
local_cache.SetDefaultExpire(time.Duration(global.GVA_CONFIG.JWT.ExpiresTime))) |
|
|
|
// 从db加载jwt数据
|
|
|
|
if global.GVA_DB != nil { |
|
|
|
system.LoadAll() |
|
|
|
} |
|
|
|
local_cache.SetDefaultExpire(time.Second * time.Duration(global.GVA_CONFIG.JWT.ExpiresTime))) |
|
|
|
return v |
|
|
|
} |