@@ -15,16 +15,20 @@ const oldValue2 = lines.find((line) => line.startsWith("ZEN_MODELS2"))?.split("=
1515const oldValue3 = lines . find ( ( line ) => line . startsWith ( "ZEN_MODELS3" ) ) ?. split ( "=" ) [ 1 ]
1616const oldValue4 = lines . find ( ( line ) => line . startsWith ( "ZEN_MODELS4" ) ) ?. split ( "=" ) [ 1 ]
1717const oldValue5 = lines . find ( ( line ) => line . startsWith ( "ZEN_MODELS5" ) ) ?. split ( "=" ) [ 1 ]
18+ const oldValue6 = lines . find ( ( line ) => line . startsWith ( "ZEN_MODELS6" ) ) ?. split ( "=" ) [ 1 ]
1819if ( ! oldValue1 ) throw new Error ( "ZEN_MODELS1 not found" )
1920if ( ! oldValue2 ) throw new Error ( "ZEN_MODELS2 not found" )
2021if ( ! oldValue3 ) throw new Error ( "ZEN_MODELS3 not found" )
2122if ( ! oldValue4 ) throw new Error ( "ZEN_MODELS4 not found" )
2223if ( ! oldValue5 ) throw new Error ( "ZEN_MODELS5 not found" )
24+ if ( ! oldValue6 ) throw new Error ( "ZEN_MODELS6 not found" )
2325
2426// store the prettified json to a temp file
2527const filename = `models-${ Date . now ( ) } .json`
2628const 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+ )
2832console . log ( "tempFile" , tempFile . name )
2933
3034// open temp file in vim and read the file on close
@@ -33,15 +37,17 @@ const newValue = JSON.stringify(JSON.parse(await tempFile.text()))
3337ZenData . validate ( JSON . parse ( newValue ) )
3438
3539// update the secret
36- const chunk = Math . ceil ( newValue . length / 5 )
40+ const chunk = Math . ceil ( newValue . length / 6 )
3741const newValue1 = newValue . slice ( 0 , chunk )
3842const newValue2 = newValue . slice ( chunk , chunk * 2 )
3943const newValue3 = newValue . slice ( chunk * 2 , chunk * 3 )
4044const 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 )
4247
4348await $ `bun sst secret set ZEN_MODELS1 ${ newValue1 } `
4449await $ `bun sst secret set ZEN_MODELS2 ${ newValue2 } `
4550await $ `bun sst secret set ZEN_MODELS3 ${ newValue3 } `
4651await $ `bun sst secret set ZEN_MODELS4 ${ newValue4 } `
4752await $ `bun sst secret set ZEN_MODELS5 ${ newValue5 } `
53+ await $ `bun sst secret set ZEN_MODELS6 ${ newValue6 } `
0 commit comments