Repository navigation
Expand file tree
/
Copy pathsync.config.ts
More file actions
41 lines (40 loc) · 1.82 KB
/
Copy pathsync.config.ts
File metadata and controls
41 lines (40 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { bindings, defineConfig, exports, triggers } from "cf/config"
import { stage, stageAccount } from "./stage"
// The Worker that syncs R2 SQL aggregates into the data database (packages/data/server/src/worker.ts): the
// DataSyncWorkflow, and the cron handler that starts its runs. The schedules must match
// packages/data/server/src/schedule.ts, which maps the daily one to a history run.
export default defineConfig(({ mode }) => {
const current = stage(mode)
const name = `opencode-data-sync-${current}`
return {
// Anomaly
accountId: stageAccount(current),
worker: {
name,
compatibilityDate: "2026-07-25",
// Also copies string bindings into process.env (packages/data/core/src/resource.ts).
compatibilityFlags: ["nodejs_compat"],
// The 5-minute maximum, for ranking a full week of geo rows.
limits: { cpuMs: 300_000 },
exports: {
// One instance per run: a plan step, then one step per stat period and retention cohort.
DataSyncWorkflow: exports.workflow({ name }),
},
env: {
DataSyncWorkflow: bindings.workflow({ name, worker: name, exportName: "DataSyncWorkflow" }),
STAGE: bindings.text(current),
...(current === "dev" && { R2_SQL_ACCOUNT_ID: bindings.text(stageAccount(current)) }),
// Set from AWS Secrets Manager (opencode/<stage>/*) by the deploy job.
DATA_DATABASE_HOST: bindings.secret(),
DATA_DATABASE_USERNAME: bindings.secret(),
DATA_DATABASE_PASSWORD: bindings.secret(),
R2_SQL_AUTH_TOKEN: bindings.secret(),
DATA_HIDDEN_MODELS: bindings.secret(),
},
triggers: [triggers.scheduled({ schedule: "5 * * * *" }), triggers.scheduled({ schedule: "20 3 * * *" })],
workersDev: false,
previewUrls: false,
observability: { enabled: true },
},
}
})