gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: deployment helpers


From: gnunet
Subject: [taler-wallet-core] branch master updated: deployment helpers
Date: Mon, 02 Aug 2021 15:20:05 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new fc2be33e deployment helpers
fc2be33e is described below

commit fc2be33e32cd858cfaaa2e0faf386f507b8c4857
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Aug 2 15:20:00 2021 +0200

    deployment helpers
---
 packages/taler-util/src/talerconfig.ts | 20 ++++++++--------
 packages/taler-wallet-cli/src/index.ts | 44 ++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/packages/taler-util/src/talerconfig.ts 
b/packages/taler-util/src/talerconfig.ts
index a40d6a12..624d4ff3 100644
--- a/packages/taler-util/src/talerconfig.ts
+++ b/packages/taler-util/src/talerconfig.ts
@@ -98,37 +98,37 @@ export class ConfigValue<T> {
   constructor(
     private sectionName: string,
     private optionName: string,
-    private val: string | undefined,
+    public value: string | undefined,
     private converter: (x: string) => T,
   ) {}
 
   required(): T {
-    if (!this.val) {
+    if (!this.value) {
       throw new ConfigError(
         `required option [${this.sectionName}]/${this.optionName} not found`,
       );
     }
-    return this.converter(this.val);
+    return this.converter(this.value);
   }
 
   orUndefined(): T | undefined {
-    if (this.val !== undefined) {
-      return this.converter(this.val);
+    if (this.value !== undefined) {
+      return this.converter(this.value);
     } else {
       return undefined;
     }
   }
 
   orDefault(v: T): T | undefined {
-    if (this.val !== undefined) {
-      return this.converter(this.val);
+    if (this.value !== undefined) {
+      return this.converter(this.value);
     } else {
       return v;
     }
   }
 
   isDefined(): boolean {
-    return this.val !== undefined;
+    return this.value !== undefined;
   }
 }
 
@@ -303,7 +303,7 @@ export class Configuration {
 
   private nestLevel = 0;
 
-  loadFromFilename(filename: string, opts: LoadOptions = {}): void {
+  private loadFromFilename(filename: string, opts: LoadOptions = {}): void {
     filename = expandPath(filename);
 
     const checkCycle = () => {
@@ -339,7 +339,7 @@ export class Configuration {
     }
   }
 
-  loadGlob(parentFilename: string, fileglob: string): void {
+  private loadGlob(parentFilename: string, fileglob: string): void {
     const resolvedParent = nodejs_fs().realpathSync(parentFilename);
     const parentDir = nodejs_path().dirname(resolvedParent);
 
diff --git a/packages/taler-wallet-cli/src/index.ts 
b/packages/taler-wallet-cli/src/index.ts
index b7bcbd87..26ee9566 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.",
 });

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]