feat(cabana): mail preview and test send to yourself

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 13:02:49 +01:00
parent 4fd2ed07eb
commit 0c73c8d4f1
22 changed files with 1233 additions and 16 deletions

View File

@@ -234,7 +234,14 @@ func installCooler(ctx context.Context, app *backpack.App) (*cooler.Handle, erro
}
if h.RateLimitRedis() {
// longest bucket decay is 1 minute; sweep at 2x (as BuildRouter)
if err := app.Publish[Store](h.RateLimitStore(NewMemoryStore(2 * time.Minute))); err != nil {
store := h.RateLimitStore(NewMemoryStore(2 * time.Minute))
if err := app.Publish[Store](store); err != nil {
_ = h.Close()
return nil, fmt.Errorf("surf: %w", err)
}
// cabana looks this up for the mail test-send limit (and any other
// fixed-window admission outside BuildRouter's throttle middleware).
if err := app.Publish[cooler.Attempter](store); err != nil {
_ = h.Close()
return nil, fmt.Errorf("surf: %w", err)
}