gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 01/03: fetch currency from configuration


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 01/03: fetch currency from configuration
Date: Tue, 12 Jun 2018 10:28:46 +0200

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

marcello pushed a commit to branch master
in repository merchant.

commit f9f7a591fde21f97ad37e408e749d644594d5093
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jun 12 09:03:52 2018 +0200

    fetch currency from configuration
---
 .../taler-merchant-generate-payments_new.c         | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/merchant-tools/taler-merchant-generate-payments_new.c 
b/src/merchant-tools/taler-merchant-generate-payments_new.c
index e59433f..c30dd34 100644
--- a/src/merchant-tools/taler-merchant-generate-payments_new.c
+++ b/src/merchant-tools/taler-merchant-generate-payments_new.c
@@ -44,6 +44,7 @@
 #define MISSING_BANK_URL 4
 #define FAILED_TO_LAUNCH_BANK 5
 #define BAD_CLI_ARG 6
+#define BAD_CONFIG_FILE 7
 
 /* Hard-coded params.  Note, the bank is expected to
  * have the Tor user with account number 3 and password 'x'.
@@ -90,8 +91,14 @@ static unsigned int payments_number = 1;
 static unsigned int tracks_number = 1;
 
 
+/**
+ * Usually set as ~/.config/taler.net
+ */
 static const char *default_config_file;
 
+/**
+ * Log level used during the run.
+ */
 static char *loglev;
 
 /**
@@ -115,6 +122,11 @@ static char *logfile;
 static char *merchant_url;
 
 /**
+ * Currency used.
+ */
+static char *currency;
+
+/**
  * Actual commands collection.
  */
 static void
@@ -391,6 +403,7 @@ int
 main (int argc,
       char *const *argv)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
 
   default_config_file = GNUNET_OS_project_data_get
     ()->user_config_file;
@@ -475,6 +488,28 @@ main (int argc,
   if (NULL == cfg_filename)
     cfg_filename = (char *) default_config_file;
 
+  cfg = GNUNET_CONFIGURATION_create ();
+  if (GNUNET_OK != GNUNET_CONFIGURATION_load
+      (cfg,
+       cfg_filename))
+  {
+    TALER_LOG_ERROR ("Could not parse configuration\n");
+    return BAD_CONFIG_FILE;
+  }
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
+      (cfg,
+       "taler",
+       "currency",
+       &currency))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "taler",
+                               "currency");
+    GNUNET_CONFIGURATION_destroy (cfg);
+    return BAD_CONFIG_FILE;
+  }
+  GNUNET_CONFIGURATION_destroy (cfg);
+
   if (NULL == merchant_url)
   {
     TALER_LOG_ERROR ("Option -m is mandatory!\n");

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]