refactor: 精简配置体系,移除 OAuth 登录/Rate Limit/Admin env 配置

- 移除 .env.example 中 Feature Flags 段(代码中不存在这些 env var)
- 移除 Google/GitHub OAuth 登录认证代码(auth/oauth.go、auth_handler
  OAuthAuthorize/OAuthCallback 路由、auth_service OAuthLogin),保留
  Twitter/Google 作为消息渠道 provider
- 从 OAuthConfig 移除 GitHub 字段(Google 保留供 channel provider 使用)
- 移除 RateLimitConfig 可配置性,RateLimit 中间件改为硬编码 100 req/min、
  60s window,移除 config/validator/reloader 中的 rate_limit 相关代码
- 移除 .env.example 中 GOCHAT_ADMIN_EMAIL/PASSWORD 配置
- 新增 gochat init 命令:交互式或通过 --email/--password/--name flags
  初始化超级管理员账户,创建默认 Account + AccountUser 关联
This commit is contained in:
Rogee
2026-07-29 16:26:19 +08:00
parent 7ed53bec47
commit fa6737e258
15 changed files with 209 additions and 732 deletions
+2 -3
View File
@@ -104,10 +104,9 @@ func (s *E2ETestSuite) SetupSuite() {
_ = redisClient // keep miniredis alive for test duration
refreshTokenStore := auth.NewRefreshTokenStore(redisClient, &cfg.JWT)
oauthService := auth.NewOAuthService(db, cfg)
mfaService := auth.NewMFAService(db)
authService := service.NewAuthService(db, jwtService, refreshTokenStore, oauthService, mfaService)
authHandler := handler.NewAuthHandler(authService, oauthService)
authService := service.NewAuthService(db, jwtService, refreshTokenStore, mfaService)
authHandler := handler.NewAuthHandler(authService)
// Register auth routes using helper function
handler.RegisterAuthRoutes(r.Group("/api/v1"), authHandler)