From ba6fde59c3991e455176c6ef699011c2dbb787de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= Date: Tue, 5 Jun 2018 07:34:04 +0200 Subject: [PATCH] Fixed HTTPS listening port --- subregsim/__main__.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/subregsim/__main__.py b/subregsim/__main__.py index abdfcdc..f4c4f1a 100644 --- a/subregsim/__main__.py +++ b/subregsim/__main__.py @@ -4,7 +4,7 @@ from __future__ import (absolute_import, print_function) -__version__ = "0.2" +__version__ = "0.3" import configargparse import logging @@ -86,24 +86,26 @@ def main(): arguments = parse_command_line() - api = Api(arguments.username, arguments.password, arguments.domain) - dispatcher = ApiDispatcher(arguments.url) - dispatcher.register_api(api) - use_ssl = has_ssl and arguments.ssl use_dns = has_dns and arguments.dns - httpd = ApiHttpServer((arguments.host, arguments.port), use_ssl, dispatcher) - stop_servers = [ httpd ] + api = Api(arguments.username, arguments.password, arguments.domain) + dispatcher = ApiDispatcher(arguments.url) + dispatcher.register_api(api) if use_ssl: log.info("Starting HTTPS server to listen on {}:{}...".format(arguments.host, arguments.ssl_port)) + + httpd = ApiHttpServer((arguments.host, arguments.ssl_port), use_ssl, dispatcher) httpd.socket = ssl.wrap_socket(httpd.socket, keyfile=arguments.ssl_private_key, certfile=arguments.ssl_certificate, server_side=True) else: log.info("Starting HTTP server to listen on {}:{}...".format(arguments.host, arguments.port)) + httpd = ApiHttpServer((arguments.host, arguments.port), use_ssl, dispatcher) + + stop_servers = [httpd] if use_dns: log.info("Starting DNS server to listen on {}:{}...".format(arguments.dns_host, arguments.dns_port))