Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
636 B · 14 lines
JavaScript
123456789101112131415// Set one string variable in a tfvars JSON file, preserving its other keys// (JSON allows no comments, so the file cannot mark itself as generated:// deploy-site.sh writes release_sha into infra/terraform.tfvars.json here).import { existsSync, readFileSync, writeFileSync } from 'node:fs'
const [file, key, value] = process.argv.slice(2)if (!file || !key || value === undefined) { console.error('usage: patch-tfvars.mjs <file.tfvars.json> <key> <value>') process.exit(2)}
const vars = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : {}vars[key] = valuewriteFileSync(file, JSON.stringify(vars, null, 2) + '\n')