修复问题

This commit is contained in:
bjdgyc
2024-10-22 14:14:10 +08:00
parent 1c5b269aa3
commit c0c15815f9
4 changed files with 49 additions and 32 deletions

View File

@@ -2,9 +2,11 @@ package base
import (
"fmt"
"github.com/bjdgyc/anylink/pkg/utils"
"os"
"path/filepath"
"reflect"
"strings"
)
const (
@@ -123,6 +125,11 @@ func initServerCfg() {
if Cfg.JwtSecret == defaultJwt {
fmt.Fprintln(os.Stderr, "=== 使用默认的jwt_secret有安全风险请设置新的jwt_secret ===")
// 安全问题,自动生成新的密钥
jwtSecret, _ := utils.RandSecret(40, 60)
jwtSecret = strings.Trim(jwtSecret, "=")
Cfg.JwtSecret = jwtSecret
}
fmt.Printf("ServerCfg: %+v \n", Cfg)