diff options
author | Florian Dold <florian@dold.me> | 2024-02-29 18:37:13 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-02-29 23:24:06 +0100 |
commit | 277a5c641df336d8b5b2d9bd6559e45f0b02aa79 (patch) | |
tree | 49cbdadaf04b5630cdae3e2a89e6d3a74d30632b /packages/taler-wallet-cli/src | |
parent | 206780bb0ee763bcf50a3f4f9f78579a8adcdb3a (diff) | |
download | wallet-core-277a5c641df336d8b5b2d9bd6559e45f0b02aa79.tar.xz |
wallet-core: improve config handling, test builtin exchange config
Diffstat (limited to 'packages/taler-wallet-cli/src')
-rw-r--r-- | packages/taler-wallet-cli/src/index.ts | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index ffe033b24..773379044 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -251,6 +251,7 @@ interface CreateWalletResult { async function createLocalWallet( walletCliArgs: WalletCliArgsType, notificationHandler?: (n: WalletNotification) => void, + noInit?: boolean, ): Promise<CreateWalletResult> { const dbPath = walletCliArgs.wallet.walletDbFile ?? defaultWalletDbPath; const myHttpLib = createPlatformHttpLib({ @@ -267,23 +268,29 @@ async function createLocalWallet( } }, cryptoWorkerType: walletCliArgs.wallet.cryptoWorker as any, - config: { - features: {}, - testing: { - devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"), - denomselAllowLate: checkEnvFlag( - "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE", - ), - emitObservabilityEvents: observabilityEventFile != null, - skipDefaults: walletCliArgs.wallet.skipDefaults, - }, - }, }); applyVerbose(walletCliArgs.wallet.verbose); + const res = { wallet: wh.wallet, getStats: wh.getDbStats }; + + if (!noInit) { + return res; + } try { - await wh.wallet.handleCoreApiRequest("initWallet", "native-init", {}); - return { wallet: wh.wallet, getStats: wh.getDbStats }; + await wh.wallet.handleCoreApiRequest("initWallet", "native-init", { + config: { + features: {}, + testing: { + devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"), + denomselAllowLate: checkEnvFlag( + "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE", + ), + emitObservabilityEvents: observabilityEventFile != null, + skipDefaults: walletCliArgs.wallet.skipDefaults, + }, + }, + }); + return res; } catch (e) { const ed = getErrorDetailFromException(e); console.error("Operation failed: " + summarizeTalerErrorDetail(ed)); @@ -1196,6 +1203,9 @@ advancedCli .requiredOption("unixPath", ["--unix-path"], clk.STRING, { default: "wallet-core.sock", }) + .flag("noInit", ["--no-init"], { + help: "Do not initialize the wallet. The client must send the initWallet message.", + }) .action(async (args) => { logger.info(`serving at ${args.serve.unixPath}`); const onNotif = (notif: WalletNotification) => { |