@@ -15,16 +15,20 @@ const oldValue2 = lines.find((line) => line.startsWith("ZEN_MODELS2"))?.split("= |
15 | 15 | const oldValue3 = lines.find((line) => line.startsWith("ZEN_MODELS3"))?.split("=")[1] |
16 | 16 | const oldValue4 = lines.find((line) => line.startsWith("ZEN_MODELS4"))?.split("=")[1] |
17 | 17 | const oldValue5 = lines.find((line) => line.startsWith("ZEN_MODELS5"))?.split("=")[1] |
| 18 | +const oldValue6 = lines.find((line) => line.startsWith("ZEN_MODELS6"))?.split("=")[1] |
18 | 19 | if (!oldValue1) throw new Error("ZEN_MODELS1 not found") |
19 | 20 | if (!oldValue2) throw new Error("ZEN_MODELS2 not found") |
20 | 21 | if (!oldValue3) throw new Error("ZEN_MODELS3 not found") |
21 | 22 | if (!oldValue4) throw new Error("ZEN_MODELS4 not found") |
22 | 23 | if (!oldValue5) throw new Error("ZEN_MODELS5 not found") |
| 24 | +if (!oldValue6) throw new Error("ZEN_MODELS6 not found") |
23 | 25 |
|
24 | 26 | // store the prettified json to a temp file |
25 | 27 | const filename = `models-${Date.now()}.json` |
26 | 28 | const tempFile = Bun.file(path.join(os.tmpdir(), filename)) |
27 | | -await tempFile.write(JSON.stringify(JSON.parse(oldValue1 + oldValue2 + oldValue3 + oldValue4 + oldValue5), null, 2)) |
| 29 | +await tempFile.write( |
| 30 | + JSON.stringify(JSON.parse(oldValue1 + oldValue2 + oldValue3 + oldValue4 + oldValue5 + oldValue6), null, 2), |
| 31 | +) |
28 | 32 | console.log("tempFile", tempFile.name) |
29 | 33 |
|
30 | 34 | // open temp file in vim and read the file on close |
@@ -33,15 +37,17 @@ const newValue = JSON.stringify(JSON.parse(await tempFile.text())) |
33 | 37 | ZenData.validate(JSON.parse(newValue)) |
34 | 38 |
|
35 | 39 | // update the secret |
36 | | -const chunk = Math.ceil(newValue.length / 5) |
| 40 | +const chunk = Math.ceil(newValue.length / 6) |
37 | 41 | const newValue1 = newValue.slice(0, chunk) |
38 | 42 | const newValue2 = newValue.slice(chunk, chunk * 2) |
39 | 43 | const newValue3 = newValue.slice(chunk * 2, chunk * 3) |
40 | 44 | const newValue4 = newValue.slice(chunk * 3, chunk * 4) |
41 | | -const newValue5 = newValue.slice(chunk * 4) |
| 45 | +const newValue5 = newValue.slice(chunk * 4, chunk * 5) |
| 46 | +const newValue6 = newValue.slice(chunk * 5) |
42 | 47 |
|
43 | 48 | await $`bun sst secret set ZEN_MODELS1 ${newValue1}` |
44 | 49 | await $`bun sst secret set ZEN_MODELS2 ${newValue2}` |
45 | 50 | await $`bun sst secret set ZEN_MODELS3 ${newValue3}` |
46 | 51 | await $`bun sst secret set ZEN_MODELS4 ${newValue4}` |
47 | 52 | await $`bun sst secret set ZEN_MODELS5 ${newValue5}` |
| 53 | +await $`bun sst secret set ZEN_MODELS6 ${newValue6}` |