moxie/settings-reference

Settings reference

Everything under src/settings/ is loaded into moxie.settings (directly or indirectly) and drives routing, upstream URLs, cache headers, and response spec headers.

Directory overview

src/settings/
├── routes/           # URL routing: per-site + shared
│   ├── sites/        # foxnews.js, foxbusiness.js, foxweather.js, outkick.js, …
│   └── shared.js     # Cross-brand route entries
├── env/              # dev / stage / prod: origins, partner URLs, feature flags
├── sites/            # Per-site metadata and overrides (identifiers, hosts)
├── caching/          # Named cache policies (max-age, stale-*, noindex)
└── specs/            # Named response specifications (content-type, JSON:API, etc.)

Routes (settings/routes/)

  • Site files define which path patterns exist for each first-segment prefix (fn, fb, …).
  • shared.js defines routes that resolve to src/apis/shared/... handlers.
  • Each route entry typically sets:
    • routes: pattern strings with {tokens}.
    • variables: allowed values per token (optional).
    • group: directory segment under apis/{site}/.
    • specification: key into settings/specs.
    • caching: key into settings/caching.
    • framework: fallback only if no endpoint index.js exists.

See Router & routes for resolution order.

Environment (settings/env/)

  • dev, stage, prod JSON (or JS) bundles: partner endpoints, CDN origins, internal service base URLs.
  • MOXIE_ENV (or ?env=) selects which env file applies for upstream calls.
  • Keep secrets out of committed JSON — use Terraform / Lambda env / GitHub Secrets for true secrets; local defaults live in build/configs/env.js.

Sites (settings/sites/)

  • Per-brand configuration: labels, hosts, internal ids used in mapping and staticish tokens ([[site]], etc.).

Caching (settings/caching/)

  • Named policies referenced by route caching field.
  • Common names: standard, mobile, liveblog, disabled — see Caching deep dive.

Specifications (settings/specs/)

  • Define how the framework sets Content-Type and related headers for specification on routes.
  • Examples: json, json-api, mobile, xml, swagger — see Response specifications.

Editing discipline

  • One route change often requires handler + config + mapping under src/apis/ — keep route keys and directory names in sync.
  • After changing routes, smoke-test ?debugga=route,config on a representative URL.