read dev data sync from the dev lake

This commit is contained in:
Dax Raad
2026-11-11 16:32:54 -05:00
Unverified
parent 33123b1c42
commit afbd99f93f
3 changed files with 7 additions and 2 deletions
@@ -18,6 +18,7 @@
"exportName": "DataSyncWorkflow"
},
"STAGE": { "type": "text", "value": "dev" },
"R2_SQL_ACCOUNT_ID": { "type": "text", "value": "d8e944f537ceef3f06a5bd3aec1d7a53" },
"DATA_DATABASE_HOST": { "type": "secret" },
"DATA_DATABASE_USERNAME": { "type": "secret" },
"DATA_DATABASE_PASSWORD": { "type": "secret" },
+5 -2
View File
@@ -1,7 +1,8 @@
// The stage's resources, read from the environment. Deployed Workers (services/data) get them as bindings, which
// nodejs_compat copies into process.env; scripts on your machine read your exported variables. Each value is read
// when used, so importing this module never touches the environment.
const ACCOUNT_ID = "15d29c8639fd3733b1b5486a2acfd968"
const PRODUCTION_ACCOUNT_ID = "15d29c8639fd3733b1b5486a2acfd968"
const DEV_ACCOUNT_ID = "d8e944f537ceef3f06a5bd3aec1d7a53"
function required(name: string) {
const value = process.env[name]
@@ -36,7 +37,9 @@ export const Resource = {
},
},
R2Sql: {
accountId: ACCOUNT_ID,
get accountId() {
return stage() === "dev" ? (process.env.R2_SQL_ACCOUNT_ID ?? DEV_ACCOUNT_ID) : PRODUCTION_ACCOUNT_ID
},
namespace: "inference",
table: "generation",
get bucket() {
+1
View File
@@ -24,6 +24,7 @@ export default defineConfig(({ mode }) => {
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(),