taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit adc791b93045f539ffa9390d149e9dfb88541f19
parent 09e4c287605fd3d8d8762d817e4ecc467bdd0207
Author: Florian Dold <florian@dold.me>
Date:   Thu, 25 Sep 2025 11:04:46 +0200

harness: new gen-doco-config tool for donau setup

Diffstat:
Mpackages/taler-harness/src/index.ts | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 58 insertions(+), 6 deletions(-)

diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts @@ -77,9 +77,9 @@ import { AML_PROGRAM_FROM_ATTRIBUTES_TO_CONTEXT } from "integrationtests/test-ky import { AML_PROGRAM_NEXT_MEASURE_FORM } from "integrationtests/test-kyc-two-forms.js"; import { execSync } from "node:child_process"; import fs from "node:fs"; +import net from "node:net"; import os from "node:os"; import path from "node:path"; -import net from "node:net"; import postgres from "postgres"; import { URLImpl } from "../../taler-util/src/whatwg-url.js"; import { runBench1 } from "./bench1.js"; @@ -1487,6 +1487,56 @@ deploymentCli console.log(out); }); +deploymentCli + .subcommand("coincfg", "gen-doco-config", { + help: "Generate a donation unit configuration for dibay.", + }) + .requiredOption("minAmount", ["--min-amount"], clk.STRING, { + help: "Smallest denomination", + }) + .requiredOption("maxAmount", ["--max-amount"], clk.STRING, { + help: "Largest denomination", + }) + .action(async (args) => { + let out = ""; + + const stamp = Math.floor(new Date().getTime() / 1000); + + const coinMin = Amounts.parseOrThrow(args.coincfg.minAmount); + const coinMax = Amounts.parseOrThrow(args.coincfg.maxAmount); + if (coinMin.currency != coinMax.currency) { + console.error("currency mismatch"); + process.exit(1); + } + const currency = coinMin.currency; + let x = coinMin; + let n = 1; + + out += "# Donation unit configuration for the donau.\n"; + out += '# Should be placed in "/etc/donau/config.d/units.conf".\n'; + out += "\n"; + + while (Amounts.cmp(x, coinMax) < 0) { + out += `[DOCO_${currency}_n${n}]\n`; + out += `VALUE = ${Amounts.stringify(x)}\n`; + out += `DURATION_WITHDRAW = 1 year\n`; + out += `ANCHOR_ROUND = 1 year\n`; + out += `DURATION_SPEND = 2 years\n`; + out += `DURATION_LEGAL = 3 years\n`; + out += `FEE_WITHDRAW = ${currency}:0\n`; + out += `FEE_DEPOSIT = ${currency}:0\n`; + out += `FEE_REFRESH = ${currency}:0\n`; + out += `FEE_REFUND = ${currency}:0\n`; + out += `RSA_KEYSIZE = 2048\n`; + out += `CIPHER = RSA\n`; + out += "\n"; + x = Amounts.add(x, x).amount; + n++; + } + + console.log(out); + }); + talerHarnessCli.subcommand("logtest", "logtest").action(async (args) => { logger.trace("This is a trace message."); logger.info("This is an info message."); @@ -1633,11 +1683,13 @@ talerHarnessCli const socketPath = args.runHelper.socket; const input = fs.readFileSync(0, "utf-8").trim(); - const stream = net.createConnection({path:socketPath}); - stream.write(JSON.stringify({ - stdin: input, - args: process.argv - })); + const stream = net.createConnection({ path: socketPath }); + stream.write( + JSON.stringify({ + stdin: input, + args: process.argv, + }), + ); stream.end(); });