移除 backend .env,暂时关闭 JWT,改为一次性登录
This commit is contained in:
@@ -3,15 +3,13 @@ package config
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ListenAddr string
|
||||
DatabaseURL string
|
||||
AuthDBPath string
|
||||
JWTSecret []byte
|
||||
TushareAPIURL string
|
||||
ListenAddr string
|
||||
DatabaseURL string
|
||||
AuthDBPath string
|
||||
TushareAPIURL string
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -24,11 +22,6 @@ func Load() (*Config, error) {
|
||||
if cfg.DatabaseURL == "" {
|
||||
return nil, fmt.Errorf("DATABASE_URL 环境变量未设置")
|
||||
}
|
||||
secret := strings.TrimSpace(os.Getenv("JWT_SECRET"))
|
||||
if len(secret) < 16 {
|
||||
return nil, fmt.Errorf("JWT_SECRET 必须至少 16 个字符 (建议 openssl rand -hex 32)")
|
||||
}
|
||||
cfg.JWTSecret = []byte(secret)
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user