[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: Passing values to p
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: Passing values to payments generator via config file. |
Date: |
Tue, 21 Mar 2017 16:57:45 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 5499f44 Passing values to payments generator via config file.
5499f44 is described below
commit 5499f4482612204df7030278f4146d1f6e8cafd6
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Mar 21 16:56:35 2017 +0100
Passing values to payments generator via config file.
---
src/samples/generate_payments.c | 96 +++++++++++++++++++++++++++++++++++++++++
src/samples/test_merchant.priv | 1 -
2 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c
index d887eff..a370c0d 100644
--- a/src/samples/generate_payments.c
+++ b/src/samples/generate_payments.c
@@ -32,6 +32,32 @@
#define INSTANCE "FSF"
#define CURRENCY "EUR"
+/**
+ * Exchange URI to withdraw from and deposit to.
+ */
+static char *exchange_uri;
+
+/**
+ * Merchant backend to get proposals from and pay.
+ */
+static char *merchant_uri;
+
+/**
+ * Customer's bank URI, communicated at withdrawal time
+ * to the exchange; must be the same as the exchange's bank.
+ */
+static char *bank_uri;
+
+/**
+ * Which merchant instance we use.
+ */
+static char *instance;
+
+/**
+ * Currency used to generate payments.
+ */
+static char *currency;
+
#define ORDER_MAX_SIZE 1000
/**
@@ -1370,6 +1396,76 @@ main (int argc,
struct GNUNET_OS_Process *merchantd;
unsigned int cnt;
struct GNUNET_SIGNAL_Context *shc_chld;
+ char *config_file;
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_MANDATORY (GNUNET_GETOPT_OPTION_FILENAME ('c',
+ "config",
+ NULL,
+
"Configuration file",
+
&config_file)),
+ GNUNET_GETOPT_OPTION_END
+ };
+
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_GETOPT_run (argv[0],
+ options,
+ argc,
+ argv));
+
+ cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file));
+
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
+
"payments-generator",
+ "exchange",
+ &exchange_uri))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "'exchange' config value invalid.\n");
+ return 77;
+ }
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
+
"payments-generator",
+ "merchant",
+ &merchant_uri))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "'merchant' config value invalid.\n");
+ return 77;
+ }
+
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
+
"payments-generator",
+ "bank",
+ &bank_uri))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "'bank' config value invalid.\n");
+ return 77;
+ }
+
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
+
"payments-generator",
+ "instance",
+ &instance))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "'instance' config value invalid.\n");
+ return 77;
+ }
+
+ if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
+
"payments-generator",
+ "currency",
+ ¤cy))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "'currency' config value invalid.\n");
+ return 77;
+ }
+
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");
diff --git a/src/samples/test_merchant.priv b/src/samples/test_merchant.priv
deleted file mode 100644
index 9c18c35..0000000
--- a/src/samples/test_merchant.priv
+++ /dev/null
@@ -1 +0,0 @@
-`�&-���./��� jx�GݢO:6l,ζXT4�
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: Passing values to payments generator via config file.,
gnunet <=