Appearance
Constants Documentation ​
Overview ​
This section documents the constants used in the Brand Portal. Constants are located in app/constants/ and provide shared configuration values and pure helper functions used by middleware, components, and composables.
File Information ​
- Path:
app/constants/ - Purpose: Centralized constants and domain/routing helpers for URL and host handling
- Auto-import: The
nuxt.configincludesconstants/**inimports.dirs, so these are auto-imported where used.
Constants Structure ​
app/constants/
└── domains.ts # Main app hosts and host normalizationModules ​
domains.ts ​
Path: app/constants/domains.ts
Purpose: Defines which hosts serve the main application (brand in path). Any other host is treated as a custom domain (brand by host). Used by the check-url middleware, token page, and Error component for verify-domain logic and redirect behavior.
Exports:
MAIN_APP_HOSTS— Readonly array of host strings (with or without port) that are considered the main app. Examples:localhost:3001,localhost:3004,devdealer.collage.inc,uatdealer.collage.inc,dam.collage.inc,app.collage.inc, etc.isMainAppHost(host: string): boolean— Returns whether the given host is inMAIN_APP_HOSTS. Strips port before comparison so thathostandhost:portboth match when the host part is listed.hostWithoutPort(host: string): string— Returns the host portion of the string, without the port (e.g. for use in comparisons or keys).
Usage:
- check-url middleware: Determines if the current request is for the main app or a custom domain and sets brand/workspace context and redirects accordingly.
- Error component / verify-domain: Used when displaying errors or verifying domain for secure flows.
- Token login page: Context for token-based access and redirects.
Related:
- Middleware - check-url - URL validation and brand verification
- Components - Error - Error display and domain verification
Related Documentation ​
- Utils - Utility functions
- Middleware - Route protection and access control