diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-03 21:58:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-03 21:58:36 +0200 |
commit | ba3f70390a1e7210195c41e3afa3e7fe1511eb96 (patch) | |
tree | 8828877b90b208e0ccd85a9c013ef61829b3c33c /src/testing/testing_api_helpers_bank.c | |
parent | 06676e72cb063c7abb264cbfd527f5c2d414dc7c (diff) | |
download | exchange-ba3f70390a1e7210195c41e3afa3e7fe1511eb96.tar.xz |
restructure configuration, move bank account credentials from exchange-account-XXX to exchange-accountcredentials-XXX
Diffstat (limited to 'src/testing/testing_api_helpers_bank.c')
-rw-r--r-- | src/testing/testing_api_helpers_bank.c | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c index a82bcbfe3..d7cce01bb 100644 --- a/src/testing/testing_api_helpers_bank.c +++ b/src/testing/testing_api_helpers_bank.c @@ -292,10 +292,14 @@ TALER_TESTING_prepare_nexus (const char *config_filename, char *database = NULL; // silence compiler char *exchange_payto_uri; + GNUNET_assert (0 == + strncasecmp (config_section, + "exchange-account-", + strlen ("exchange-account-"))); cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_load (cfg, config_filename)) + GNUNET_CONFIGURATION_load (cfg, + config_filename)) { GNUNET_CONFIGURATION_destroy (cfg); GNUNET_break (0); @@ -357,14 +361,25 @@ TALER_TESTING_prepare_nexus (const char *config_filename, } } - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (cfg, - config_section, - &bc->exchange_auth)) { - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; + char *csn; + + GNUNET_asprintf (&csn, + "exchange-accountcredentials-%s", + &config_section[strlen ("exchange-account-")]); + + + if (GNUNET_OK != + TALER_BANK_auth_parse_cfg (cfg, + csn, + &bc->exchange_auth)) + { + GNUNET_break (0); + GNUNET_CONFIGURATION_destroy (cfg); + GNUNET_free (csn); + return GNUNET_SYSERR; + } + GNUNET_free (csn); } GNUNET_CONFIGURATION_destroy (cfg); bc->exchange_payto = exchange_payto_uri; @@ -400,10 +415,15 @@ TALER_TESTING_prepare_bank (const char *config_filename, char *database; char *exchange_payto_uri; + GNUNET_assert (0 == + strncasecmp (config_section, + "exchange-account-", + strlen ("exchange-account-"))); cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != - GNUNET_CONFIGURATION_load (cfg, config_filename)) + GNUNET_CONFIGURATION_load (cfg, + config_filename)) { GNUNET_CONFIGURATION_destroy (cfg); GNUNET_break (0); @@ -522,14 +542,24 @@ TALER_TESTING_prepare_bank (const char *config_filename, } GNUNET_OS_process_destroy (dbreset_proc); } - if (GNUNET_OK != - TALER_BANK_auth_parse_cfg (cfg, - config_section, - &bc->exchange_auth)) { - GNUNET_break (0); - GNUNET_CONFIGURATION_destroy (cfg); - return GNUNET_SYSERR; + char *csn; + + GNUNET_asprintf (&csn, + "exchange-accountcredentials-%s", + &config_section[strlen ("exchange-account-")]); + + if (GNUNET_OK != + TALER_BANK_auth_parse_cfg (cfg, + csn, + &bc->exchange_auth)) + { + GNUNET_break (0); + GNUNET_free (csn); + GNUNET_CONFIGURATION_destroy (cfg); + return GNUNET_SYSERR; + } + GNUNET_free (csn); } GNUNET_CONFIGURATION_destroy (cfg); bc->exchange_payto = exchange_payto_uri; |