Configuration, environment, and session context.
System settings are stored encrypted in the database and accessed through a caching layer. Environment variables provide runtime configuration for the edge deployment.
Get booking fee percentage from database. Returns 0 if not set.
Get the Bunny CDN API key from environment
Return the cached session if already resolved, or undefined if not yet resolved
Get the CDN hostname derived from the effective domain. Replaces ".bunny.run" with ".b-cdn.net" for the CNAME target.
Get the effective domain synchronously (must call loadEffectiveDomain first).
Get allowed embed hosts from database (encrypted, parsed to array) Returns empty array if not configured (embedding allowed from anywhere)
Get an environment variable value Checks process.env first (Bunny Edge), falls back to Deno.env (local dev)
Type guard: check if a string is a valid AdminLevel
Check if Bunny CDN pull zone management is enabled Requires BUNNY_API_KEY to be set
Type guard: check if an arbitrary string is a valid ContactField
Type guard: check if an arbitrary string is a valid EventType
Whether an event can accept payments (has a price or allows pay-what-you-want)
Check if payments are enabled (any provider configured with valid keys)
Load the effective domain from DB, falling back to the request URL hostname.
Parse a flash cookie value into type and message, or null if invalid
Get a required environment variable, throwing if not set.
Use this instead of getEnv(key) as string when the variable must exist.
Reset effective domain cache (for testing).
Run a function within a session-memoization scope
Store the resolved session in the current request scope
Set effective domain directly (for testing).
- attachment_downloads: number
- checked_in: boolean
- checked_in_v2: number
- created: string
- date: string | null
- event_id: number
- id: number
- payment_id: string
- pii_blob: string
- price_paid: string
- price_paid_v2: number
- quantity: number
- refunded: boolean
- refunded_v2: number
- ticket_token: string
- ticket_token_index: string
- active: boolean
- attachment_name: string
- attachment_url: string
- bookable_days: string[]
- can_pay_more: boolean
- closes_at: string | null
- created: string
- date: string
- description: string
- event_type: EventType
- fields: EventFields
- group_id: number
- hidden: boolean
- id: number
- image_url: string
- location: string
- max_attendees: number
- max_price: number
- max_quantity: number
- maximum_days_after: number
- minimum_days_before: number
- name: string
- non_transferable: boolean
- slug: string
- slug_index: string
- thank_you_url: string
- unit_price: number
- webhook_url: string
Admin API event shape — all event fields except internal indices. Used by both admin JSON API and admin templates to ensure consistent field exposure. Snake_case keys match the DB schema.
Admin role levels
Session data needed by admin page templates
Individual contact field name
& Partial<
Required name+email with optional phone/address/special_instructions from ContactInfo
Attendee contact details — the core PII fields collected at registration
Contact fields setting for an event (comma-separated ContactField names, or empty for name-only)
Event type: standard (one-time) or daily (date-based booking)
Supported payment provider identifiers
Short keys used in the PII blob JSON to minimize encrypted payload size
UI theme
All valid contact field names (runtime array matching the ContactField union)
Usage
import * as mod from "docs/config.ts";