diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 175e5e42..1bfc3428 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -4,8 +4,8 @@ import ( "crypto/rsa" "errors" config2 "ferry/tools/config" - "io/ioutil" "net/http" + "os" "strings" "time" @@ -234,7 +234,7 @@ func (mw *GinJWTMiddleware) readKeys() error { } func (mw *GinJWTMiddleware) privateKey() error { - keyData, err := ioutil.ReadFile(mw.PrivKeyFile) + keyData, err := os.ReadFile(mw.PrivKeyFile) if err != nil { return ErrNoPrivKeyFile } @@ -247,7 +247,7 @@ func (mw *GinJWTMiddleware) privateKey() error { } func (mw *GinJWTMiddleware) publicKey() error { - keyData, err := ioutil.ReadFile(mw.PubKeyFile) + keyData, err := os.ReadFile(mw.PubKeyFile) if err != nil { return ErrNoPubKeyFile } diff --git a/tools/config/application.go b/tools/config/application.go index cd306856..945446e5 100644 --- a/tools/config/application.go +++ b/tools/config/application.go @@ -22,7 +22,7 @@ func InitApplication(cfg *viper.Viper) *Application { Host: cfg.GetString("host"), Port: portDefault(cfg), Name: cfg.GetString("name"), - JwtSecret: cfg.GetString("jwtSecret"), + JwtSecret: viper.GetString("settings.jwt.secret"), Mode: cfg.GetString("mode"), DemoMsg: cfg.GetString("demoMsg"), Domain: cfg.GetString("domain"), @@ -41,7 +41,7 @@ func portDefault(cfg *viper.Viper) string { } func isHttpsDefault(cfg *viper.Viper) bool { - if cfg.GetString("ishttps") == "" || cfg.GetBool("ishttps") == false{ + if cfg.GetString("ishttps") == "" || cfg.GetBool("ishttps") == false { return false } else { return true