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.

Functions

f
buildSessionCookie
No documentation available
f
clearSessionCookie
No documentation available
f
getAllowedDomain

Get allowed domain for security validation (runtime config via Bunny secrets) This is a required configuration that hardens origin validation

f
getBunnyApiKey

Get the Bunny CDN API key from environment

f
getCachedSession

Return the cached session if already resolved, or undefined if not yet resolved

f
getCdnHostname

Get the CDN hostname derived from ALLOWED_DOMAIN. Replaces ".bunny.run" with ".b-cdn.net" for the CNAME target.

f
getCurrencyCode

Get currency code from database Defaults to GBP if not set

f
getEmbedHosts

Get allowed embed hosts from database (encrypted, parsed to array) Returns empty array if not configured (embedding allowed from anywhere)

f
getEnv

Get an environment variable value Checks process.env first (Bunny Edge), falls back to Deno.env (local dev)

f
getPaymentProvider

Get the configured payment provider type Returns null if no provider is configured

f
getSessionCookieName
No documentation available
f
getSquareAccessToken

Get Square access token from database (encrypted) Returns null if not configured

f
getSquareLocationId

Get Square location ID from database Returns null if not configured

f
getSquareSandbox

Get Square sandbox mode setting from database Returns true if sandbox mode is enabled

f
getSquareWebhookSignatureKey

Get Square webhook signature key from database (encrypted) Returns null if not configured

f
getStripePublishableKey

Get Stripe publishable key from environment variable Returns null if not set

f
getStripeSecretKey

Get Stripe secret key from database (encrypted) Returns null if not configured (payments disabled)

f
getStripeWebhookSecret

Get Stripe webhook signing secret from database (encrypted) Automatically configured when Stripe secret key is saved

f
getTz

Get the configured timezone synchronously from cache. Safe to call from synchronous code (templates, helpers) because the settings cache is populated by middleware on every request.

f
isAdminLevel

Type guard: check if a string is a valid AdminLevel

f
isBunnyCdnEnabled

Check if Bunny CDN pull zone management is enabled Requires BUNNY_API_KEY to be set

f
isContactField

Type guard: check if an arbitrary string is a valid ContactField

f
isEventType

Type guard: check if an arbitrary string is a valid EventType

f
isPaidEvent

Whether an event can accept payments (has a price or allows pay-what-you-want)

f
isPaymentsEnabled

Check if payments are enabled (any provider configured with valid keys)

f
isSecureMode
No documentation available
f
isSetupComplete

Check if initial setup has been completed Result is cached in memory - once true, we never query again.

f
requireEnv

Get a required environment variable, throwing if not set. Use this instead of getEnv(key) as string when the variable must exist.

f
runWithSessionContext

Run a function within a session-memoization scope

f
setCachedSession

Store the resolved session in the current request scope

Interfaces

Type Aliases

T
AdminLevel

Admin role levels

T
AdminSession

Session data needed by admin page templates

T
ContactField

Individual contact field name

T
ContactFields

Required name+email with optional phone/address/special_instructions from ContactInfo

T
ContactInfo

Attendee contact details — the core PII fields collected at registration

T
EventFields

Contact fields setting for an event (comma-separated ContactField names, or empty for name-only)

T
EventType

Event type: standard (one-time) or daily (date-based booking)

Variables

v
configApi

Stubbable API for internal calls (testable via spyOn, like stripeApi/squareApi)

v
CONTACT_FIELDS

All valid contact field names (runtime array matching the ContactField union)