移除 backend .env,暂时关闭 JWT,改为一次性登录

This commit is contained in:
fish
2026-05-03 20:41:43 +08:00
parent d0e5ddb678
commit fbcde3cc71
8 changed files with 21 additions and 74 deletions

View File

@@ -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
}