commit b6501f354e106eadbd40d525f6e719426beb8f16
parent 697db24a3e937a1b5827b533f7b52730f95a1c31
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 20 Jan 2018 13:55:18 +0100
move port to config
Diffstat:
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c
@@ -254,11 +254,6 @@ struct HttpRequest
/**
- * The port the proxy is running on (default 7777)
- */
-static unsigned long long port = GNUNET_GNS_PROXY_PORT;
-
-/**
* The cURL download task (curl multi API).
*/
static struct GNUNET_SCHEDULER_Task * curl_download_task;
@@ -1352,6 +1347,9 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ unsigned long long port;
+
+
cfg = c;
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
@@ -1378,13 +1376,37 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (c,
+ "twister",
+ "DESTINATION_BASE_URL",
+ &target_server_base_url))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "twister",
+ "DESTINATION_BASE_URL");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (c,
+ "twister",
+ "HTTP_PORT",
+ &port))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "twister",
+ "HTTP_PORT");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Proxy listens on port %llu\n",
port);
/* start MHD daemon for HTTP */
mhd_daemon = MHD_start_daemon (MHD_USE_DEBUG,
- port,
+ (uint16_t) port,
NULL, NULL,
&create_response, NULL,
MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
@@ -1414,11 +1436,6 @@ int
main (int argc, char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_ulong ('p',
- "port",
- NULL,
- gettext_noop ("listen on specified port (default: 7777)"),
- &port),
GNUNET_GETOPT_OPTION_END
};
static const char* page =