Add support for SSL if the certificate is found in the config directory

This commit is contained in:
Joseph Schorr 2014-11-25 16:36:21 -05:00
parent 660a640de6
commit 04fc6d82a5
2 changed files with 17 additions and 6 deletions

View file

@ -67,13 +67,13 @@ class BuilderServer(object):
self._controller_app = controller_app
def run(self, host):
def run(self, host, ssl=None):
LOGGER.debug('Initializing the lifecycle manager')
self._lifecycle_manager.initialize()
LOGGER.debug('Initializing all members of the event loop')
loop = trollius.get_event_loop()
trollius.Task(self._initialize(loop, host))
trollius.Task(self._initialize(loop, host, ssl))
LOGGER.debug('Starting server on port 8080, with controller on port 8181')
try:
@ -161,7 +161,7 @@ class BuilderServer(object):
@trollius.coroutine
def _initialize(self, loop, host):
def _initialize(self, loop, host, ssl=None):
self._loop = loop
# Create the WAMP server.
@ -169,8 +169,8 @@ class BuilderServer(object):
transport_factory.setProtocolOptions(failByDrop=True)
# Initialize the controller server and the WAMP server
create_wsgi_server(self._controller_app, loop=loop, host=host, port=CONTROLLER_PORT)
yield From(loop.create_server(transport_factory, host, WEBSOCKET_PORT))
create_wsgi_server(self._controller_app, loop=loop, host=host, port=CONTROLLER_PORT, ssl=ssl)
yield From(loop.create_server(transport_factory, host, WEBSOCKET_PORT, ssl=ssl))
# Initialize the work queue checker.
yield From(self._work_checker())