src/examples/tour/brands.ts

Every source

src/examples/tour/brands.ts
import type { SynqSite } from '@synqauth/nextjs/config'

import { demoSites } from '../../lib/sites.ts'

// One deployment, three brands (AERO-3484): the app is registered once in
// each brand of the org, and each brand is served at its own host. A
// request's host picks its brand: its issuer, and the app there with its
// secret. Sessions are sealed for one site and never open on another, so
// signing in to Nova Arcade says nothing about Synq Demo. src/synq.config.ts
// hands these to synqAuth() as `hosts` and `resolve`.

/** Each brand's site, by the host it's served at. Read when the server starts, never at build. */
export const BRANDS: Readonly<Record<string, SynqSite>> = Object.fromEntries(
  demoSites(process.env).map((site) => [
    site.host,
    { issuer: site.issuer, clientId: site.clientId, clientSecret: site.clientSecret },
  ]),
)