mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-02-12 00:39:29 -06:00
Cosmetic improvement
This commit is contained in:
@@ -25,7 +25,7 @@ const (
|
||||
PropertyBucketSize = 5 * time.Minute
|
||||
updateLimitsBatchSize = 100
|
||||
maxVerifyBatchSize = 100_000
|
||||
apiService = "api"
|
||||
ApiService = "api"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -126,7 +126,7 @@ func (s *Server) Init(ctx context.Context, verifyFlushInterval, authBackfillDela
|
||||
s.Levels.Init(2*time.Second /*access log interval*/, PropertyBucketSize /*backfill interval*/)
|
||||
s.Auth.StartBackfill(authBackfillDelay)
|
||||
|
||||
baseVerifyCtx := context.WithValue(context.Background(), common.ServiceContextKey, apiService)
|
||||
baseVerifyCtx := context.WithValue(context.Background(), common.ServiceContextKey, ApiService)
|
||||
var cancelVerifyCtx context.Context
|
||||
cancelVerifyCtx, s.VerifyLogCancel = context.WithCancel(context.WithValue(baseVerifyCtx, common.TraceIDContextKey, "flush_verify_log"))
|
||||
|
||||
@@ -150,7 +150,7 @@ func (s *Server) Setup(router *http.ServeMux, domain string, verbose bool, secur
|
||||
|
||||
if corsOpts.Debug {
|
||||
ctx := common.TraceContext(context.TODO(), "cors")
|
||||
ctx = context.WithValue(ctx, common.ServiceContextKey, apiService)
|
||||
ctx = context.WithValue(ctx, common.ServiceContextKey, ApiService)
|
||||
corsOpts.Logger = &common.FmtLogger{Ctx: ctx, Level: common.LevelTrace}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ func (s *Server) Shutdown() {
|
||||
func (s *Server) setupWithPrefix(domain string, router *http.ServeMux, corsHandler, security alice.Constructor) {
|
||||
prefix := domain + "/"
|
||||
slog.Debug("Setting up the API routes", "prefix", prefix)
|
||||
svc := common.ServiceMiddleware(apiService)
|
||||
svc := common.ServiceMiddleware(ApiService)
|
||||
publicChain := alice.New(svc, common.Recovered, security, s.Metrics.Handler)
|
||||
// NOTE: auth middleware provides rate limiting internally
|
||||
puzzleChain := publicChain.Append(s.RateLimiter.RateLimit, monitoring.Traced, common.TimeoutHandler(1*time.Second))
|
||||
|
||||
Reference in New Issue
Block a user