Skip to content

Commit 0ed7fac

Browse files
author
Frank
committed
wip: zen
1 parent 80b9cd1 commit 0ed7fac

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

packages/console/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"update-models": "script/update-models.ts",
3131
"promote-models-to-dev": "script/promote-models.ts dev",
3232
"promote-models-to-prod": "script/promote-models.ts production",
33+
"pull-models-from-dev": "script/pull-models.ts dev",
3334
"typecheck": "tsgo --noEmit"
3435
},
3536
"devDependencies": {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bun
2+
3+
import { $ } from "bun"
4+
import path from "path"
5+
import { ZenData } from "../src/model"
6+
7+
const stage = process.argv[2]
8+
if (!stage) throw new Error("Stage is required")
9+
10+
const root = path.resolve(process.cwd(), "..", "..", "..")
11+
12+
// read the secret
13+
const ret = await $`bun sst secret list --stage ${stage}`.cwd(root).text()
14+
const lines = ret.split("\n")
15+
const value1 = lines.find((line) => line.startsWith("ZEN_MODELS1"))?.split("=")[1]
16+
const value2 = lines.find((line) => line.startsWith("ZEN_MODELS2"))?.split("=")[1]
17+
const value3 = lines.find((line) => line.startsWith("ZEN_MODELS3"))?.split("=")[1]
18+
const value4 = lines.find((line) => line.startsWith("ZEN_MODELS4"))?.split("=")[1]
19+
if (!value1) throw new Error("ZEN_MODELS1 not found")
20+
if (!value2) throw new Error("ZEN_MODELS2 not found")
21+
if (!value3) throw new Error("ZEN_MODELS3 not found")
22+
if (!value4) throw new Error("ZEN_MODELS4 not found")
23+
24+
// validate value
25+
ZenData.validate(JSON.parse(value1 + value2 + value3 + value4))
26+
27+
// update the secret
28+
await $`bun sst secret set ZEN_MODELS1 ${value1}`
29+
await $`bun sst secret set ZEN_MODELS2 ${value2}`
30+
await $`bun sst secret set ZEN_MODELS3 ${value3}`
31+
await $`bun sst secret set ZEN_MODELS4 ${value4}`

0 commit comments

Comments
 (0)