From 27149117a486a8f339c6a3e19740c9ff91ea205e Mon Sep 17 00:00:00 2001 From: MS Date: Mon, 27 Jul 2020 11:24:07 +0200 Subject: ApiKey option --- src/merchant-tools/taler-merchant-setup-reserve.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 @@ -86,6 +86,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). */ @@ -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", -- cgit v1.2.3