From ecc657d489a167863d3aef22a5157aa225329d14 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 14 Sep 2021 16:26:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:jwt=E7=AD=BE=E5=90=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/service/system/sys_initdb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/service/system/sys_initdb.go b/server/service/system/sys_initdb.go index a0a768e5..45d3b747 100644 --- a/server/service/system/sys_initdb.go +++ b/server/service/system/sys_initdb.go @@ -5,6 +5,8 @@ import ( "fmt" "path/filepath" + uuid "github.com/satori/go.uuid" + "github.com/flipped-aurora/gin-vue-admin/server/config" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/example" @@ -33,6 +35,7 @@ func (initDBService *InitDBService) writeConfig(viper *viper.Viper, mysql config for k, v := range cs { viper.Set(k, v) } + viper.Set("jwt.signing-key", uuid.NewV4()) return viper.WriteConfig() } @@ -159,6 +162,7 @@ func (initDBService *InitDBService) InitDB(conf request.InitDB) error { global.GVA_DB = nil return err } + if err = initDBService.writeConfig(global.GVA_VP, MysqlConfig); err != nil { return err }