Skip to content

Commit

Permalink
Fixed HTTPS listening port
Browse files Browse the repository at this point in the history
  • Loading branch information
oldium committed Jun 5, 2018
1 parent 71aa34c commit ba6fde5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions subregsim/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from __future__ import (absolute_import, print_function)

__version__ = "0.2"
__version__ = "0.3"

import configargparse
import logging
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit ba6fde5

Please sign in to comment.