summaryrefslogtreecommitdiff
path: root/src/merchant-tools
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-07-27 11:24:07 +0200
committerMS <ms@taler.net>2020-07-27 11:24:15 +0200
commit27149117a486a8f339c6a3e19740c9ff91ea205e (patch)
tree67315c293dfc511f4046d4992033a2ccfe682c94 /src/merchant-tools
parent801da06363ff85dc773a1c5776920ad0665b6209 (diff)
downloadmerchant-27149117a486a8f339c6a3e19740c9ff91ea205e.tar.gz
merchant-27149117a486a8f339c6a3e19740c9ff91ea205e.tar.bz2
merchant-27149117a486a8f339c6a3e19740c9ff91ea205e.zip
ApiKey option
Diffstat (limited to 'src/merchant-tools')
-rw-r--r--src/merchant-tools/taler-merchant-setup-reserve.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/merchant-tools/taler-merchant-setup-reserve.c b/src/merchant-tools/taler-merchant-setup-reserve.c
index 66ece5af..b229af39 100644
--- a/src/merchant-tools/taler-merchant-setup-reserve.c
+++ b/src/merchant-tools/taler-merchant-setup-reserve.c
@@ -87,6 +87,11 @@ static char *certfile;
static char *keyfile;
/**
+ * This value goes in the Authorization:-header.
+ */
+static char *apikey;
+
+/**
* Passphrase to decrypt client's TLS private key file (optional).
*/
static char *keypass;
@@ -189,6 +194,18 @@ run (void *cls,
certfile,
keyfile,
keypass);
+ if (NULL != apikey)
+ {
+ // not assuming that libcurl copies this value.
+ char *auth_header;
+
+ GNUNET_assert (GNUNET_OK == GNUNET_asprintf (&auth_header,
+ "Authorizattion: ApiKey %s",
+ apikey));
+ GNUNET_CURL_append_header (ctx,
+ auth_header);
+ }
+
/* setup termination logic */
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
@@ -261,6 +278,11 @@ main (int argc,
"KEYFILEPASSPHRASE",
"passphrase needed to decrypt the TLS client private key file",
&keypass),
+ GNUNET_GETOPT_option_string ('K',
+ "apikey",
+ "APIKEY",
+ "API key to use in the HTTP request",
+ &apikey),
GNUNET_GETOPT_option_string ('t',
"type",
"CERTTYPE",