diff options
Diffstat (limited to 'packages/console/core/script/update-black.ts')
| -rwxr-xr-x | packages/console/core/script/update-black.ts | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/packages/console/core/script/update-black.ts b/packages/console/core/script/update-black.ts deleted file mode 100755 index 695a5d3ce..000000000 --- a/packages/console/core/script/update-black.ts +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bun - -import { $ } from "bun" -import path from "path" -import os from "os" -import { BlackData } from "../src/black" - -const root = path.resolve(process.cwd(), "..", "..", "..") -const secrets = await $`bun sst secret list`.cwd(root).text() - -// read value -const lines = secrets.split("\n") -const oldValue = lines.find((line) => line.startsWith("ZEN_BLACK_LIMITS"))?.split("=")[1] ?? "{}" -if (!oldValue) throw new Error("ZEN_BLACK_LIMITS not found") - -// store the prettified json to a temp file -const filename = `black-${Date.now()}.json` -const tempFile = Bun.file(path.join(os.tmpdir(), filename)) -await tempFile.write(JSON.stringify(JSON.parse(oldValue), null, 2)) -console.log("tempFile", tempFile.name) - -// open temp file in vim and read the file on close -await $`vim ${tempFile.name}` -const newValue = JSON.stringify(JSON.parse(await tempFile.text())) -BlackData.validate(JSON.parse(newValue)) - -// update the secret -await $`bun sst secret set ZEN_BLACK_LIMITS ${newValue}` |
