aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/index.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-02 15:20:00 +0200
committerFlorian Dold <florian@dold.me>2021-08-02 15:20:00 +0200
commitfc2be33e32cd858cfaaa2e0faf386f507b8c4857 (patch)
tree86a5fb66add5c5261205079377d3e9bf0e542013 /packages/taler-wallet-cli/src/index.ts
parenta8a4f76ed8be3e6173e7bc9c586f66ed70a6acf4 (diff)
downloadwallet-core-fc2be33e32cd858cfaaa2e0faf386f507b8c4857.tar.xz
deployment helpers
Diffstat (limited to 'packages/taler-wallet-cli/src/index.ts')
-rw-r--r--packages/taler-wallet-cli/src/index.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index b7bcbd875..26ee95661 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -55,6 +55,7 @@ import {
WalletCoreApiClient,
Wallet,
} from "@gnu-taler/taler-wallet-core";
+import { lintDeployment } from "./lint.js";
// This module also serves as the entry point for the crypto
// thread worker, and thus must expose these two handlers.
@@ -869,6 +870,49 @@ const deploymentCli = walletCli.subcommand("deploymentArgs", "deployment", {
help: "Subcommands for handling GNU Taler deployments.",
});
+deploymentCli.subcommand("lint", "lint").action(async (args) => {
+ lintDeployment();
+});
+
+deploymentCli
+ .subcommand("coincfg", "gen-coin-config", {
+ help: "Generate a coin/denomination configuration for the exchange.",
+ })
+ .requiredOption("currency", ["--currency"], clk.STRING, {
+ help: "Currency to use",
+ })
+ .action(async (args) => {
+ let out = "";
+ const currency = args.coincfg.currency;
+
+ const min = Amounts.parseOrThrow(`${currency}:0.01`);
+ const max = Amounts.parseOrThrow(`${currency}:100`);
+ let x = min;
+ let n = 1;
+
+ out += "# Coin configuration for the exchange.\n";
+ out += '# Should be placed in "/etc/taler/conf.d/exchange-coins.conf".\n';
+ out += "\n";
+
+ while (Amounts.cmp(x, max) < 0) {
+ out += `[COIN_${currency}_${n}]\n`;
+ out += `VALUE = ${Amounts.stringify(x)}\n`;
+ out += `DURATION_WITHDRAW = 7 days\n`;
+ out += `DURATION_SPEND = 2 years\n`;
+ out += `DURATION_LEGAL = 6 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 += "\n";
+ x = Amounts.add(x, x).amount;
+ n++;
+ }
+
+ console.log(out);
+ });
+
const deploymentConfigCli = deploymentCli.subcommand("configArgs", "config", {
help: "Subcommands the Taler configuration.",
});