mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
- services/data/stage.ts: stage(mode) throws on anything but dev or production, used by all three configs, build.ts and deploy.ts - packages/stats -> packages/data (@opencode/data-app, -core, -server) - StatsSyncWorkflow -> DataSyncWorkflow, instance ids data-hourly-/data-history-, Data* resource keys, data sync log lines - worker, route, workflow and cron names unchanged
18 lines
644 B
TypeScript
18 lines
644 B
TypeScript
// The stage a `--mode` deploys. Only `dev` and `production` are stages: anything else, including no mode at all, throws,
|
|
// so a typo or a bare `cf deploy` can never fall through to production.
|
|
const hosts = {
|
|
dev: "dev.opencode.ai",
|
|
production: "opencode.ai",
|
|
} as const
|
|
|
|
export type Stage = keyof typeof hosts
|
|
|
|
export function stage(mode: string | undefined): Stage {
|
|
if (mode === "dev" || mode === "production") return mode
|
|
throw new Error(`Unknown mode ${JSON.stringify(mode)}; pass --mode dev or --mode production`)
|
|
}
|
|
|
|
// The host the stage's site is served from.
|
|
export function stageHost(value: Stage) {
|
|
return hosts[value]
|
|
}
|