M3 收尾: 限流/配额 + 前端骨架屏 + 单端口托管前端
- ratelimit(内存计数): 密钥级每日请求数/Token 配额、用户级每秒速率 (OT_RATELIMIT_USER_RPS), 超限返回 429 - 网关 Auth 前置配额/限流检查, finishUsage 累计密钥 token 用量 - 前端 Skeleton 组件 + Dashboard/管理总览加载态 - Go 服务托管 web/dist 静态资源(SPA 回退), 单端口即可访问前后端 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/openteam/server/internal/config"
|
||||
"github.com/openteam/server/internal/pkg/crypto"
|
||||
"github.com/openteam/server/internal/pkg/jwt"
|
||||
"github.com/openteam/server/internal/pkg/ratelimit"
|
||||
"github.com/openteam/server/internal/store"
|
||||
"github.com/openteam/server/internal/usage"
|
||||
"gorm.io/gorm"
|
||||
@@ -23,6 +24,7 @@ type App struct {
|
||||
JWT *jwt.Manager
|
||||
Usage *usage.Recorder
|
||||
Health *channel.HealthMonitor
|
||||
Limit *ratelimit.Limiter
|
||||
startedAt time.Time
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
@@ -44,6 +46,7 @@ func New(cfg *config.Config) (*App, error) {
|
||||
}
|
||||
a.ctx, a.cancel = context.WithCancel(context.Background())
|
||||
a.Usage = usage.NewRecorder(db)
|
||||
a.Limit = ratelimit.New()
|
||||
|
||||
if err := a.Seed(); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user