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
@@ -56,9 +56,9 @@ func setupChatwootAuthTest(t *testing.T) (*gin.Engine, *gorm.DB, *model.User) {
jwtCfg := &config.JWTConfig{Secret: "auth-test-secret", ExpiryHours: 1, RefreshExpiryHours: 24}
jwtSvc := auth.NewJWTService(jwtCfg)
refreshStore := auth.NewRefreshTokenStore(nil, jwtCfg)
authSvc := service.NewAuthService(db, jwtSvc, refreshStore, nil, nil)
authSvc := service.NewAuthService(db, jwtSvc, refreshStore, nil)
profileSvc := service.NewProfileService(repository.NewUserRepo(db), repository.NewAccountUserRepo(db), repository.NewAccessTokenRepo(db))
handler := NewAuthHandler(authSvc, nil, profileSvc)
handler := NewAuthHandler(authSvc, profileSvc)
router := gin.New()
RegisterChatwootAuthRoutes(router.Group("/auth"), handler)