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.
Create a type guard from a readonly array of string literal values
Get booking fee percentage from database. Returns 0 if not set.
Get the Bunny CDN API key from environment
Get the Bunny DNS subdomain suffix (e.g. ".tickets") from environment
Get the Bunny DNS zone ID from environment
Get the Bunny Edge Script ID from environment
Return the cached session if already resolved, or undefined if not yet resolved
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)
Get the READ_ONLY_FROM cutoff ISO string, or null if not set
Get the RENEWAL_URL, or null if not set
Check if Bunny CDN pull zone management is enabled Requires both BUNNY_API_KEY and BUNNY_SCRIPT_ID to be set
Check if Bunny DNS subdomain feature is enabled. Requires BUNNY_API_KEY and BUNNY_DNS_ZONE_ID to be set.
Pure helper: is the current time within the warning window before cutoff?
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)
Check if the system is in read-only mode based on the READ_ONLY_FROM cutoff
Pure helper: is the site read-only based on a cutoff timestamp?
Check if the site should show a pre-expiry warning banner
Load the effective domain from DB, falling back to the request URL hostname.
The single definition of "a valid booking duration": a whole number of days in [1, MAX_DURATION_DAYS], with non-finite input degrading to 1.
Parse a flash cookie value into type, message, and optional result
Parse a string into a positive integer for warning days. Returns defaultVal on bad input.
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
Seed the effective domain from the request's own hostname.
Store the resolved session in the current request scope
Set effective domain directly (for testing).
- active: boolean
- assign_built_site: boolean
- attachment_name: string
- attachment_url: string
- bookable_days: string[]
- can_pay_more: boolean
- closes_at: string | null
- created: string
- date: string
- description: string
- duration_days: number
- event_type: EventType
- fields: EventFields
- group_id: number
- hidden: boolean
- id: number
- image_url: string
- initial_site_months: number
- location: string
- max_attendees: number
- max_price: number
- max_quantity: number
- maximum_days_after: number
- minimum_days_before: number
- months_per_unit: number
- name: string
- non_transferable: boolean
- purchase_only: 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
A single row in the attendee table (attendee + parent event context)
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). Alias kept for documentation; runtime enforcement happens in parseEventFields.
Event type: standard (one-time) or daily (date-based booking)
| "business-email"
| "domain"
| "superuser"
Unique identifiers for settings nags that prompt the admin to complete required or recommended configuration.
A single settings nag item presented to the admin.
-
href: string
Deep link to the settings form where the value can be set.
-
id: NagId
The nag identifier.
-
label: string
Human-readable description of what needs to be configured.
Persisted payment-provider setting: an explicit provider, "none" (admin saved payments-disabled), or absent (never saved — drives the settings nag).
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)
Type guard: check if a string is a valid AdminLevel
Type guard: check if an arbitrary string is a valid ContactField
Type guard: check if an arbitrary string is a valid EventType
Type guard: check if a string is a valid PaymentProviderType
Type guard: check if a string is a valid PaymentProviderSetting
Upper bound on multi-day booking duration. Each day in a booking range adds a per-day clause to the atomic capacity SQL, so the cap keeps that statement bounded regardless of which write path set the value.
Usage
import * as mod from "docs/config.ts";