summaryrefslogtreecommitdiff
path: root/src/exchange-tools/taler-exchange-wire.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-10 17:10:20 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-10 17:10:20 +0200
commit30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd (patch)
treeb78ddf34d0360b2cf87037009d32dac0d3eaeb91 /src/exchange-tools/taler-exchange-wire.c
parent5fb65f59b2de184f4fcb1417923711bd64fe781a (diff)
downloadexchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.tar.gz
exchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.tar.bz2
exchange-30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd.zip
fixing #4386: use more sane configuration and data file structure
Diffstat (limited to 'src/exchange-tools/taler-exchange-wire.c')
-rw-r--r--src/exchange-tools/taler-exchange-wire.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/exchange-tools/taler-exchange-wire.c b/src/exchange-tools/taler-exchange-wire.c
index 5bb4835d..930086d3 100644
--- a/src/exchange-tools/taler-exchange-wire.c
+++ b/src/exchange-tools/taler-exchange-wire.c
@@ -46,6 +46,11 @@ static char *method;
*/
static char *output_filename;
+/**
+ * Our configuration.
+ */
+static struct GNUNET_CONFIGURATION_Handle *cfg;
+
/**
* The main function of the taler-exchange-sepa tool. This tool is used
@@ -59,7 +64,9 @@ int
main (int argc,
char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+ char *cfgfile = NULL;
+ const struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_CFG_FILE (&cfgfile),
{'j', "json", "JSON",
"account information in JSON format", 1,
&GNUNET_GETOPT_set_string, &json_in},
@@ -95,10 +102,26 @@ main (int argc,
options,
argc, argv) < 0)
return 1;
- if (NULL == masterkeyfile)
+ cfg = GNUNET_CONFIGURATION_create ();
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg,
+ cfgfile))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Malformed configuration file `%s', exit ...\n"),
+ cfgfile);
+ GNUNET_free_non_null (cfgfile);
+ return 1;
+ }
+ GNUNET_free_non_null (cfgfile);
+ if ( (NULL == masterkeyfile) &&
+ (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "exchange-master",
+ "MASTER_PRIV_FILE",
+ &masterkeyfile)) )
{
fprintf (stderr,
- "Master key file not given\n");
+ "Master key file not given in neither configuration nor command-line\n");
return 1;
}
eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (masterkeyfile);