Skip to content

Commit afbd99f

Browse files
committed
read dev data sync from the dev lake
1 parent 33123b1 commit afbd99f

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎.github/release/targets/data/dev/sync.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"exportName": "DataSyncWorkflow"
1919
},
2020
"STAGE": { "type": "text", "value": "dev" },
21+
"R2_SQL_ACCOUNT_ID": { "type": "text", "value": "d8e944f537ceef3f06a5bd3aec1d7a53" },
2122
"DATA_DATABASE_HOST": { "type": "secret" },
2223
"DATA_DATABASE_USERNAME": { "type": "secret" },
2324
"DATA_DATABASE_PASSWORD": { "type": "secret" },

‎packages/data/core/src/resource.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// The stage's resources, read from the environment. Deployed Workers (services/data) get them as bindings, which
22
// nodejs_compat copies into process.env; scripts on your machine read your exported variables. Each value is read
33
// when used, so importing this module never touches the environment.
4-
const ACCOUNT_ID = "15d29c8639fd3733b1b5486a2acfd968"
4+
const PRODUCTION_ACCOUNT_ID = "15d29c8639fd3733b1b5486a2acfd968"
5+
const DEV_ACCOUNT_ID = "d8e944f537ceef3f06a5bd3aec1d7a53"
56

67
function required(name: string) {
78
const value = process.env[name]
@@ -36,7 +37,9 @@ export const Resource = {
3637
},
3738
},
3839
R2Sql: {
39-
accountId: ACCOUNT_ID,
40+
get accountId() {
41+
return stage() === "dev" ? (process.env.R2_SQL_ACCOUNT_ID ?? DEV_ACCOUNT_ID) : PRODUCTION_ACCOUNT_ID
42+
},
4043
namespace: "inference",
4144
table: "generation",
4245
get bucket() {

‎services/data/sync.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default defineConfig(({ mode }) => {
2424
env: {
2525
DataSyncWorkflow: bindings.workflow({ name, worker: name, exportName: "DataSyncWorkflow" }),
2626
STAGE: bindings.text(current),
27+
...(current === "dev" && { R2_SQL_ACCOUNT_ID: bindings.text(stageAccount(current)) }),
2728
// Set from AWS Secrets Manager (opencode/<stage>/*) by the deploy job.
2829
DATA_DATABASE_HOST: bindings.secret(),
2930
DATA_DATABASE_USERNAME: bindings.secret(),

0 commit comments

Comments
 (0)