// Scratch business file for sage-1004/1006: the committed example, made loadable, with the given plug-ins. // Bot ids become distinct positive integers, date placeholders become 2027-01-01, every credential file // points at a path under NOSECRET that does not exist, and both base URLs go to 127.0.0.1:9 (discard), // so a scratch bus never reaches the live tracker or Gitea. usage: node mkbiz.mjs EXAMPLE NOSECRET PLUGINS_JSON import { readFileSync } from 'node:fs'; import { basename } from 'node:path'; const [example, nosecret, plugins] = process.argv.slice(2); const b = JSON.parse(readFileSync(example, 'utf8')); let id = 0; const walk = (o) => { for (const [k, v] of Object.entries(o)) { if (k === 'botId') o[k] = ++id; else if (v === 'YYYY-MM-DD') o[k] = '2027-01-01'; else if (k === 'file' && typeof v === 'string') o[k] = `${nosecret}/${basename(v)}`; else if (v && typeof v === 'object') walk(v); } }; walk(b); b.vars['tracker.baseUrl'] = 'http://127.0.0.1:9'; b.vars['gitea.baseUrl'] = 'http://127.0.0.1:9'; b.plugins = JSON.parse(plugins); process.stdout.write(JSON.stringify(b, null, 2) + '\n');