gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (6cc3fb3d0 -> 896841aec)


From: gnunet
Subject: [taler-wallet-core] branch master updated (6cc3fb3d0 -> 896841aec)
Date: Fri, 25 Aug 2023 11:53:30 +0200

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

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

    from 6cc3fb3d0 harness: modernize some tests
     new 3d6cff9c8 harness: modernize some tests, temporarily disable 
revocation test
     new 896841aec taler-util: set [PATH] defaults

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-harness/src/index.ts                |  33 ++++++
 .../test-age-restrictions-mixed-merchant.ts        |  21 ++--
 .../src/integrationtests/test-denom-unoffered.ts   |  20 +++-
 .../src/integrationtests/test-fee-regression.ts    |  40 ++++---
 .../integrationtests/test-merchant-longpolling.ts  |   4 +-
 .../integrationtests/test-payment-forgettable.ts   |   4 +-
 .../src/integrationtests/test-paywall-flow.ts      |  60 +++++------
 .../src/integrationtests/test-revocation.ts        |   1 +
 packages/taler-harness/src/sandcastle-config.ts    |  10 ++
 packages/taler-util/src/talerconfig.ts             | 115 +++++++++++++++++----
 10 files changed, 228 insertions(+), 80 deletions(-)
 create mode 100644 packages/taler-harness/src/sandcastle-config.ts

diff --git a/packages/taler-harness/src/index.ts 
b/packages/taler-harness/src/index.ts
index a172bc9da..841e17dc7 100644
--- a/packages/taler-harness/src/index.ts
+++ b/packages/taler-harness/src/index.ts
@@ -170,6 +170,39 @@ const sandcastleCli = 
testingCli.subcommand("sandcastleArgs", "sandcastle", {
   help: "Subcommands for handling GNU Taler sandcastle deployments.",
 });
 
+const configCli = testingCli.subcommand("configArgs", "config", {
+  help: "Subcommands for handling the Taler configuration.",
+});
+
+configCli.subcommand("show", "show").action(async (args) => {
+  const config = Configuration.load();
+  const cfgStr = config.stringify({
+    diagnostics: true,
+  });
+  console.log(cfgStr);
+});
+
+configCli
+  .subcommand("get", "get")
+  .requiredArgument("section", clk.STRING)
+  .requiredArgument("option", clk.STRING)
+  .flag("file", ["-f"])
+  .action(async (args) => {
+    const config = Configuration.load();
+    let res;
+    if (args.get.file) {
+      res = config.getString(args.get.section, args.get.option);
+    } else {
+      res = config.getPath(args.get.section, args.get.option);
+    }
+    if (res.isDefined()) {
+      console.log(res.value);
+    } else {
+      console.warn("not found");
+      process.exit(1);
+    }
+  });
+
 const deploymentCli = testingCli.subcommand("deploymentArgs", "deployment", {
   help: "Subcommands for handling GNU Taler deployments.",
 });
diff --git 
a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts
 
b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts
index 970acbb72..af90ef1c5 100644
--- 
a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts
+++ 
b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts
@@ -19,13 +19,12 @@
  */
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { defaultCoinConfig } from "../harness/denomStructures.js";
-import { GlobalTestState, WalletCli } from "../harness/harness.js";
+import { GlobalTestState } from "../harness/harness.js";
 import {
-  makeTestPayment,
   createSimpleTestkudosEnvironmentV2,
-  withdrawViaBankV2,
-  makeTestPaymentV2,
   createWalletDaemonWithClient,
+  makeTestPaymentV2,
+  withdrawViaBankV2,
 } from "../harness/helpers.js";
 
 /**
@@ -59,7 +58,7 @@ export async function runAgeRestrictionsMixedMerchantTest(t: 
GlobalTestState) {
   {
     const walletClient = walletOne;
 
-    await withdrawViaBankV2(t, {
+    const wres = await withdrawViaBankV2(t, {
       walletClient,
       bank,
       exchange,
@@ -67,6 +66,8 @@ export async function runAgeRestrictionsMixedMerchantTest(t: 
GlobalTestState) {
       restrictAge: 13,
     });
 
+    await wres.withdrawalFinishedCond;
+
     const order = {
       summary: "Buy me!",
       amount: "TESTKUDOS:5",
@@ -82,7 +83,7 @@ export async function runAgeRestrictionsMixedMerchantTest(t: 
GlobalTestState) {
   }
 
   {
-    await withdrawViaBankV2(t, {
+    const wres = await withdrawViaBankV2(t, {
       walletClient: walletTwo,
       bank,
       exchange,
@@ -90,6 +91,9 @@ export async function runAgeRestrictionsMixedMerchantTest(t: 
GlobalTestState) {
       restrictAge: 13,
     });
 
+
+    await wres.withdrawalFinishedCond;
+
     const order = {
       summary: "Buy me!",
       amount: "TESTKUDOS:5",
@@ -101,13 +105,16 @@ export async function 
runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) {
   }
 
   {
-    await withdrawViaBankV2(t, {
+    const wres = await withdrawViaBankV2(t, {
       walletClient: walletThree,
       bank,
       exchange,
       amount: "TESTKUDOS:20",
     });
 
+
+    await wres.withdrawalFinishedCond;
+
     const order = {
       summary: "Buy me!",
       amount: "TESTKUDOS:5",
diff --git 
a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts 
b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
index 1b9b91603..5a471b9aa 100644
--- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
+++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
@@ -18,12 +18,10 @@
  * Imports.
  */
 import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util";
-import { Wallet, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
 import {
-  createSimpleTestkudosEnvironment,
   createSimpleTestkudosEnvironmentV2,
-  withdrawViaBank,
   withdrawViaBankV2,
 } from "../harness/helpers.js";
 
@@ -35,7 +33,14 @@ export async function runDenomUnofferedTest(t: 
GlobalTestState) {
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: 
"TESTKUDOS:20" });
+  const wres = await withdrawViaBankV2(t, {
+    walletClient,
+    bank,
+    exchange,
+    amount: "TESTKUDOS:20",
+  });
+
+  await wres.withdrawalFinishedCond;
 
   // Make the exchange forget the denomination.
   // Effectively we completely reset the exchange,
@@ -108,7 +113,12 @@ export async function runDenomUnofferedTest(t: 
GlobalTestState) {
   });
 
   // Now withdrawal should work again.
-  await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: 
"TESTKUDOS:20" });
+  await withdrawViaBankV2(t, {
+    walletClient,
+    bank,
+    exchange,
+    amount: "TESTKUDOS:20",
+  });
 
   await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
 
diff --git a/packages/taler-harness/src/integrationtests/test-fee-regression.ts 
b/packages/taler-harness/src/integrationtests/test-fee-regression.ts
index 8c5a5bea4..e0dc4bc3b 100644
--- a/packages/taler-harness/src/integrationtests/test-fee-regression.ts
+++ b/packages/taler-harness/src/integrationtests/test-fee-regression.ts
@@ -19,18 +19,18 @@
  */
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import {
-  GlobalTestState,
   BankService,
   ExchangeService,
+  GlobalTestState,
   MerchantService,
-  setupDb,
-  WalletCli,
   getPayto,
+  setupDb,
 } from "../harness/harness.js";
 import {
-  withdrawViaBank,
-  makeTestPayment,
-  SimpleTestEnvironment,
+  SimpleTestEnvironmentNg,
+  createWalletDaemonWithClient,
+  makeTestPaymentV2,
+  withdrawViaBankV2,
 } from "../harness/helpers.js";
 
 /**
@@ -39,7 +39,7 @@ import {
  */
 export async function createMyTestkudosEnvironment(
   t: GlobalTestState,
-): Promise<SimpleTestEnvironment> {
+): Promise<SimpleTestEnvironmentNg> {
   const db = await setupDb(t);
 
   const bank = await BankService.create(t, {
@@ -147,13 +147,19 @@ export async function createMyTestkudosEnvironment(
 
   console.log("setup done!");
 
-  const wallet = new WalletCli(t);
+  const { walletClient, walletService } = await createWalletDaemonWithClient(
+    t,
+    {
+      name: "w1",
+    },
+  );
 
   return {
     commonDb: db,
     exchange,
     merchant,
-    wallet,
+    walletClient,
+    walletService,
     bank,
     exchangeBankAccount,
   };
@@ -165,19 +171,21 @@ export async function createMyTestkudosEnvironment(
 export async function runFeeRegressionTest(t: GlobalTestState) {
   // Set up test environment
 
-  const { wallet, bank, exchange, merchant } =
+  const { walletClient, bank, exchange, merchant } =
     await createMyTestkudosEnvironment(t);
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBank(t, {
-    wallet,
+  const wres = await withdrawViaBankV2(t, {
+    walletClient,
     bank,
     exchange,
     amount: "TESTKUDOS:1.92",
   });
 
-  const coins = await wallet.client.call(WalletApiOperation.DumpCoins, {});
+  await wres.withdrawalFinishedCond;
+
+  const coins = await walletClient.call(WalletApiOperation.DumpCoins, {});
 
   // Make sure we really withdraw one 0.64 and one 1.28 coin.
   t.assertTrue(coins.coins.length === 2);
@@ -188,11 +196,11 @@ export async function runFeeRegressionTest(t: 
GlobalTestState) {
     fulfillment_url: "taler://fulfillment-success/thx",
   };
 
-  await makeTestPayment(t, { wallet, merchant, order });
+  await makeTestPaymentV2(t, { walletClient, merchant, order });
 
-  await wallet.runUntilDone();
+  await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
 
-  const txs = await wallet.client.call(WalletApiOperation.GetTransactions, {});
+  const txs = await walletClient.call(WalletApiOperation.GetTransactions, {});
   t.assertAmountEquals(txs.transactions[1].amountEffective, "TESTKUDOS:1.30");
   console.log(txs);
 }
diff --git 
a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts 
b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts
index 161e8beac..59f23fe5d 100644
--- a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts
+++ b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts
@@ -43,13 +43,15 @@ export async function runMerchantLongpollingTest(t: 
GlobalTestState) {
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, {
+  const wres = await withdrawViaBankV2(t, {
     walletClient,
     bank,
     exchange,
     amount: "TESTKUDOS:20",
   });
 
+  await wres.withdrawalFinishedCond;
+
   /**
    * =========================================================================
    * Create an order and let the wallet pay under a session ID
diff --git 
a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts 
b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts
index 83f19e58e..21d76397d 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts
@@ -36,13 +36,15 @@ export async function runPaymentForgettableTest(t: 
GlobalTestState) {
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, {
+  const wres = await withdrawViaBankV2(t, {
     walletClient,
     bank,
     exchange,
     amount: "TESTKUDOS:20",
   });
 
+  await wres.withdrawalFinishedCond;
+
   {
     const order = {
       summary: "Buy me!",
diff --git a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts 
b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts
index c90898034..b0477a049 100644
--- a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts
+++ b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts
@@ -24,10 +24,17 @@ import {
   ConfirmPayResultType,
   URL,
 } from "@gnu-taler/taler-util";
-import axiosImp from "axios";
-const axios = axiosImp.default;
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2 } from 
"../harness/helpers.js";
+import {
+  createSimpleTestkudosEnvironmentV2,
+  withdrawViaBankV2,
+} from "../harness/helpers.js";
+import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
+
+const httpLib = createPlatformHttpLib({
+  allowHttp: true,
+  enableThrottling: false,
+});
 
 /**
  * Run test for basic, bank-integrated withdrawal.
@@ -40,7 +47,12 @@ export async function runPaywallFlowTest(t: GlobalTestState) 
{
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: 
"TESTKUDOS:20" });
+  await withdrawViaBankV2(t, {
+    walletClient,
+    bank,
+    exchange,
+    amount: "TESTKUDOS:20",
+  });
 
   /**
    * =========================================================================
@@ -74,9 +86,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) {
   t.assertTrue(orderStatus.already_paid_order_id === undefined);
   let publicOrderStatusUrl = new URL(orderStatus.order_status_url);
 
-  let publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
-    validateStatus: () => true,
-  });
+  let publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href);
 
   if (publicOrderStatusResp.status != 402) {
     throw Error(
@@ -85,7 +95,7 @@ export async function runPaywallFlowTest(t: GlobalTestState) {
   }
 
   let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode(
-    publicOrderStatusResp.data,
+    publicOrderStatusResp.json(),
   );
 
   console.log(pubUnpaidStatus);
@@ -102,10 +112,8 @@ export async function runPaywallFlowTest(t: 
GlobalTestState) {
   const proposalId = preparePayResp.proposalId;
 
   console.log("requesting", publicOrderStatusUrl.href);
-  publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
-    validateStatus: () => true,
-  });
-  console.log("response body", publicOrderStatusResp.data);
+  publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href);
+  console.log("response body", publicOrderStatusResp.json());
   if (publicOrderStatusResp.status != 402) {
     throw Error(
       `expected status 402 (after claiming), but got 
${publicOrderStatusResp.status}`,
@@ -113,26 +121,20 @@ export async function runPaywallFlowTest(t: 
GlobalTestState) {
   }
 
   pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode(
-    publicOrderStatusResp.data,
+    publicOrderStatusResp.json(),
   );
 
-  const confirmPayRes = await walletClient.call(
-    WalletApiOperation.ConfirmPay,
-    {
-      proposalId: proposalId,
-    },
-  );
+  const confirmPayRes = await walletClient.call(WalletApiOperation.ConfirmPay, 
{
+    proposalId: proposalId,
+  });
 
   t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done);
+  publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href);
 
-  publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
-    validateStatus: () => true,
-  });
-
-  console.log(publicOrderStatusResp.data);
+  console.log(publicOrderStatusResp.json());
 
   if (publicOrderStatusResp.status != 200) {
-    console.log(publicOrderStatusResp.data);
+    console.log(publicOrderStatusResp.json());
     throw Error(
       `expected status 200 (after paying), but got 
${publicOrderStatusResp.status}`,
     );
@@ -229,19 +231,17 @@ export async function runPaywallFlowTest(t: 
GlobalTestState) {
   console.log("requesting public status", publicOrderStatusUrl);
 
   // Ask the order status of the claimed-but-unpaid order
-  publicOrderStatusResp = await axios.get(publicOrderStatusUrl.href, {
-    validateStatus: () => true,
-  });
+  publicOrderStatusResp = await httpLib.fetch(publicOrderStatusUrl.href);
 
   if (publicOrderStatusResp.status != 402) {
     throw Error(`expected status 402, but got 
${publicOrderStatusResp.status}`);
   }
 
   pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode(
-    publicOrderStatusResp.data,
+    publicOrderStatusResp.json(),
   );
 
-  console.log(publicOrderStatusResp.data);
+  console.log(publicOrderStatusResp.json());
 
   t.assertTrue(pubUnpaidStatus.already_paid_order_id === firstOrderId);
 }
diff --git a/packages/taler-harness/src/integrationtests/test-revocation.ts 
b/packages/taler-harness/src/integrationtests/test-revocation.ts
index 0fbb4960e..04707e51a 100644
--- a/packages/taler-harness/src/integrationtests/test-revocation.ts
+++ b/packages/taler-harness/src/integrationtests/test-revocation.ts
@@ -213,3 +213,4 @@ export async function runRevocationTest(t: GlobalTestState) 
{
 
 runRevocationTest.timeoutMs = 120000;
 runRevocationTest.suites = ["wallet"];
+runRevocationTest.excludeByDefault = true;
\ No newline at end of file
diff --git a/packages/taler-harness/src/sandcastle-config.ts 
b/packages/taler-harness/src/sandcastle-config.ts
new file mode 100644
index 000000000..a7f7233ac
--- /dev/null
+++ b/packages/taler-harness/src/sandcastle-config.ts
@@ -0,0 +1,10 @@
+// Work in progress.
+// TS-based schema for the sandcastle configuration.
+
+export interface SandcastleConfig {
+  currency: string;
+  merchant: {
+    apiKey: string;
+    baseUrl: string;
+  };
+}
diff --git a/packages/taler-util/src/talerconfig.ts 
b/packages/taler-util/src/talerconfig.ts
index 948ccb9c4..d86c58678 100644
--- a/packages/taler-util/src/talerconfig.ts
+++ b/packages/taler-util/src/talerconfig.ts
@@ -1,6 +1,6 @@
 /*
  This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
+ (C) 2020-2023 Taler Systems S.A.
 
  GNU Taler is free software; you can redistribute it and/or modify it under the
  terms of the GNU General Public License as published by the Free Software
@@ -40,12 +40,22 @@ export class ConfigError extends Error {
 }
 
 enum EntryOrigin {
-  // From a default file
-  Default = 1,
-  // Loaded from file or string
-  Loaded = 2,
-  // Changed after loading
-  Changed = 3,
+  /**
+   * From a default file.
+   */
+  DefaultFile = 1,
+  /**
+   * From a system/installation specific default value.
+   */
+  DefaultSystem = 2,
+  /**
+   * Loaded from file or string
+   */
+  Loaded = 3,
+  /**
+   * Changed after loading
+   */
+  Changed = 4,
 }
 
 interface Entry {
@@ -169,12 +179,12 @@ export function pathsub(
 
           const r = lookup(inner, depth + 1);
           if (r !== undefined) {
-            s = s.substr(0, start) + r + s.substr(p + 1);
+            s = s.substring(0, start) + r + s.substring(p + 1);
             l = start + r.length;
             continue;
           } else if (defaultValue !== undefined) {
             const resolvedDefault = pathsub(defaultValue, lookup, depth + 1);
-            s = s.substr(0, start) + resolvedDefault + s.substr(p + 1);
+            s = s.substring(0, start) + resolvedDefault + s.substring(p + 1);
             l = start + resolvedDefault.length;
             continue;
           }
@@ -186,7 +196,7 @@ export function pathsub(
         if (m && m[0]) {
           const r = lookup(m[0], depth + 1);
           if (r !== undefined) {
-            s = s.substr(0, l) + r + s.substr(l + 1 + m[0].length);
+            s = s.substring(0, l) + r + s.substring(l + 1 + m[0].length);
             l = l + r.length;
             continue;
           }
@@ -492,7 +502,9 @@ export class Configuration {
           value: val,
           sourceFile: opts.filename ?? "<unknown>",
           sourceLine: lineNo,
-          origin: isDefaultSource ? EntryOrigin.Default : EntryOrigin.Loaded,
+          origin: isDefaultSource
+            ? EntryOrigin.DefaultFile
+            : EntryOrigin.Loaded,
         };
         continue;
       }
@@ -535,6 +547,23 @@ export class Configuration {
     };
   }
 
+  /**
+   * Set a string value to a value from default locations.
+   */
+  private setStringSystemDefault(
+    section: string,
+    option: string,
+    value: string,
+  ): void {
+    const sec = this.provideSection(section);
+    sec.entries[option.toUpperCase()] = {
+      value,
+      sourceLine: 0,
+      sourceFile: "<unknown>",
+      origin: EntryOrigin.DefaultSystem,
+    };
+  }
+
   /**
    * Get upper-cased section names.
    */
@@ -595,7 +624,7 @@ export class Configuration {
   lookupVariable(x: string, depth: number = 0): string | undefined {
     // We loop up options in PATHS in upper case, as option names
     // are case insensitive
-    const val = this.findEntry("PATHS", x)?.value;
+    let val = this.findEntry("PATHS", x)?.value;
     if (val !== undefined) {
       return pathsub(val, (v, d) => this.lookupVariable(v, d), depth);
     }
@@ -623,21 +652,54 @@ export class Configuration {
   }
 
   private loadDefaults(): void {
-    let bc = process.env["TALER_BASE_CONFIG"];
-    if (!bc) {
+    let baseConfigDir = process.env["TALER_BASE_CONFIG"];
+    if (!baseConfigDir) {
       /* Try to locate the configuration based on the location
        * of the taler-config binary. */
       const path = which("taler-config");
       if (path) {
-        bc = nodejs_fs.realpathSync(
+        baseConfigDir = nodejs_fs.realpathSync(
           nodejs_path.dirname(path) + "/../share/taler/config.d",
         );
       }
     }
-    if (!bc) {
-      bc = "/usr/share/taler/config.d";
+    if (!baseConfigDir) {
+      baseConfigDir = "/usr/share/taler/config.d";
+    }
+
+    let installPrefix = process.env["TALER_PREFIX"];
+    if (!installPrefix) {
+      /* Try to locate install path based on the location
+       * of the taler-config binary. */
+      const path = which("taler-config");
+      if (path) {
+        installPrefix = nodejs_fs.realpathSync(
+          nodejs_path.dirname(path) + "/..",
+        );
+      }
+    }
+    if (!installPrefix) {
+      installPrefix = "/usr";
     }
-    this.loadDefaultsFromDir(bc);
+
+    this.setStringSystemDefault(
+      "PATHS",
+      "LIBEXECDIR",
+      `${installPrefix}/taler/libexec/`,
+    );
+    this.setStringSystemDefault(
+      "PATHS",
+      "DOCDIR",
+      `${installPrefix}/share/doc/taler/`,
+    );
+    this.setStringSystemDefault("PATHS", "ICONDIR", 
`${installPrefix}/share/icons/`);
+    this.setStringSystemDefault("PATHS", "LOCALEDIR", 
`${installPrefix}/share/locale/`);
+    this.setStringSystemDefault("PATHS", "PREFIX", `${installPrefix}/`);
+    this.setStringSystemDefault("PATHS", "BINDIR", `${installPrefix}/bin`);
+    this.setStringSystemDefault("PATHS", "LIBDIR", 
`${installPrefix}/lib/taler/`);
+    this.setStringSystemDefault("PATHS", "DATADIR", 
`${installPrefix}/share/taler/`);
+
+    this.loadDefaultsFromDir(baseConfigDir);
   }
 
   getDefaultConfigFilename(): string | undefined {
@@ -698,7 +760,11 @@ export class Configuration {
       let headerWritten = false;
       for (const optionName of Object.keys(sec.entries)) {
         const entry = this.sectionMap[sectionName].entries[optionName];
-        if (opts.excludeDefaults && entry.origin === EntryOrigin.Default) {
+        if (
+          opts.excludeDefaults &&
+          (entry.origin === EntryOrigin.DefaultSystem ||
+            entry.origin === EntryOrigin.DefaultFile)
+        ) {
           continue;
         }
         if (!headerWritten) {
@@ -711,7 +777,16 @@ export class Configuration {
         }
         if (entry !== undefined) {
           if (opts.diagnostics) {
-            s += `# ${entry.sourceFile}:${entry.sourceLine}\n`;
+            switch (entry.origin) {
+              case EntryOrigin.DefaultFile:
+              case EntryOrigin.Changed:
+              case EntryOrigin.Loaded:
+                s += `# ${entry.sourceFile}:${entry.sourceLine}\n`;
+                break;
+              case EntryOrigin.DefaultSystem:
+                s += `# (system/installation default)\n`;
+                break;
+            }
           }
           s += `${optionName} = ${entry.value}\n`;
         }

-- 
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]