Skip to content

Config

function defineAstroid(config: AstroidConfig): AstroidConfig;

An identity function in the shape of Astro’s defineConfig: returns the config verbatim with full inference, and validates the invariants that would otherwise fail deep inside generation. Throws AstroidConfigError on:

  • an empty key (it names every generated binding)
  • a missing theme.name or theme.colors.brand
  • a commerce provider assigned to a role its client can’t serve
  • portal.gated, which is not implemented and refused rather than silently wiring no guard
  • editor: false alongside an option that configures the editor, such as sections, media, settings, inquiries: true or an inquiries object, or the realtime module
  • an inquiries that isn’t a boolean or an object, or an inquiries.publicForm that isn’t a boolean
  • editor: false with the authRateLimit module and no portal, since nothing signs in for the limiter to guard
  • a credit with no name, an href that isn’t an absolute http or https URL, or a logo that isn’t a root-relative path or an https URL
  • a business fact that Intl doesn’t accept: a time zone that isn’t IANA, a currency that isn’t an uppercase ISO 4217 code, a country that isn’t an uppercase ISO 3166-1 alpha-2 code, or a locale that isn’t a BCP 47 tag in canonical form
  • commerce without business.currency, or with a currency whose minor units aren’t 2 digits

Key types: AstroidConfig, Archetype (marketing | storefront | wholesale | portfolio), ModuleKind (map | pwa | wholesaleInquiry), SectionKind, Theme, Portal, CommerceConfig, BusinessConfig, CreditConfig, InquiriesConfig, SeoConfig, SecurityConfig, PwaConfig.

ASTROID_ARCHETYPE_SECTIONS maps each archetype to its default home sections.

interface BusinessConfig {
timeZone?: string; // IANA, for example, "Europe/Berlin"
currency?: string; // ISO 4217, for example, "EUR"
country?: string; // ISO 3166-1 alpha-2, for example, "DE"
locale?: string; // BCP 47, for example, "de-DE"
}

The facts louise-toolkit takes as parameters: louise-toolkit/dates needs the time zone, formatMoney the currency and locale, and the Square wallet sheet the country and currency. None has a default. commerce requires currency, and the others stay unset until the site states them.

inquiries?: boolean | InquiriesConfig;
interface InquiriesConfig {
publicForm?: boolean; // default true
}

Omitted, inquiries are on for a site with a contact section or the wholesaleInquiry module. true and false force them on or off. An object turns them on, and publicForm: false keeps the inquiries table, the Inquiries tab, and the inbox count while leaving out the public form route, POST /api/louise/forms/inquiries, and the imports only it uses. Set it when the site’s own endpoint writes the inquiries table. See Inquiries.

capturesInquiries(config) reports whether the project has inquiries, and servesInquiryForm(config) whether its worker mounts the public form route.

function astroidBusiness(config: AstroidConfig): AstroidBusiness;
function astroidBusiness(config: AstroidConfig, fact: AstroidBusinessFact): string;

With no fact, returns all four, each undefined where the config states none. With a fact, such as "currency", returns it as a string, or throws an AstroidConfigError that names business.<fact> when it’s missing. Generated code uses the second form.

Returns seo.locale when it’s set, and otherwise business.locale in Open Graph form: de-DE becomes de_DE. Returns undefined for a locale with no region, such as de, rather than choosing a territory. The scaffold’s layouts pass it to <Seo>.

astroidHasEditor(config) reports whether the project has a Louise editor, which is true unless the config sets editor: false. ASTROID_API_PREFIX is /api/v1, the prefix an editor-free app’s rate rule covers.