name = "mod-cms-d1"
compatibility_date = "2026-08-19"
compatibility_flags = ["nodejs_compat"]
main = "@astrojs/cloudflare/entrypoints/server"

[assets]
directory = "./dist"
binding = "ASSETS"

[[d1_databases]]
binding = "DB"
database_name = "mod-cms-d1"
database_id = "785da27a-7fe2-4685-bd21-38ea1546eaa9"
migrations_dir = "migrations"

[[kv_namespaces]]
binding = "SESSION"

# Rate limiting (CF Workers Rate Limiting, GA — needs Wrangler >= 4.36.0). The app fails-open when a
# binding is absent (rate-limit.ts: `if (!limiter) return null`), so local dev / a bare preview degrade
# safely; these harden production. `period` MUST be 10 or 60 (the only values CF accepts). `namespace_id`
# is any per-account-unique integer string. The four bindings match src/lib/rate-limit.ts exactly.
[[ratelimits]]
name = "ADMIN_LOGIN_LIMITER"
namespace_id = "1001"
  [ratelimits.simple]
  limit = 10
  period = 60

[[ratelimits]]
name = "ADMIN_API_LIMITER"
namespace_id = "1002"
  [ratelimits.simple]
  limit = 120
  period = 60

[[ratelimits]]
name = "COMMENTS_LIMITER"
namespace_id = "1003"
  [ratelimits.simple]
  limit = 5
  period = 60

[[ratelimits]]
name = "FORMS_LIMITER"
namespace_id = "1004"
  [ratelimits.simple]
  limit = 5
  period = 60

[[r2_buckets]]
binding = "MEDIA_BUCKET"
bucket_name = "mod-cms-media"

[vars]
MEDIA_PUBLIC_BASE_URL = "https://media.mod-cms.example"
MEDIA_MAX_BYTES = "10485760"
MEDIA_QUOTA_BYTES = "1073741824"
