make monkey_island work with common folder

This commit is contained in:
Itay Mizeretz 2018-05-23 15:56:08 +03:00
parent 0411811fe5
commit f3742c67d0
5 changed files with 7 additions and 4 deletions

1
__init__.py Normal file
View File

@ -0,0 +1 @@
__author__ = 'itay.mizeretz'

View File

@ -0,0 +1 @@
__author__ = 'itay.mizeretz'

View File

@ -0,0 +1 @@
__author__ = 'itay.mizeretz'

View File

@ -9,7 +9,7 @@ ENV_DICT = {
def load_env_from_file(): def load_env_from_file():
with open('server_config.json', 'r') as f: with open('monkey_island/cc/server_config.json', 'r') as f:
config_content = f.read() config_content = f.read()
config_json = json.loads(config_content) config_json = json.loads(config_content)
return config_json['server_config'] return config_json['server_config']

View File

@ -27,11 +27,11 @@ if __name__ == '__main__':
app = init_app(mongo_url) app = init_app(mongo_url)
if env.is_debug(): if env.is_debug():
app.run(host='0.0.0.0', debug=True, ssl_context=('server.crt', 'server.key')) app.run(host='0.0.0.0', debug=True, ssl_context=('monkey_island/cc/server.crt', 'monkey_island/cc/server.key'))
else: else:
http_server = HTTPServer(WSGIContainer(app), http_server = HTTPServer(WSGIContainer(app),
ssl_options={'certfile': os.environ.get('SERVER_CRT', 'server.crt'), ssl_options={'certfile': os.environ.get('SERVER_CRT', 'monkey_island/cc/server.crt'),
'keyfile': os.environ.get('SERVER_KEY', 'server.key')}) 'keyfile': os.environ.get('SERVER_KEY', 'monkey_island/cc/server.key')})
http_server.listen(env.get_island_port()) http_server.listen(env.get_island_port())
print('Monkey Island Server is running on https://{}:{}'.format(local_ip_addresses()[0], env.get_island_port())) print('Monkey Island Server is running on https://{}:{}'.format(local_ip_addresses()[0], env.get_island_port()))
IOLoop.instance().start() IOLoop.instance().start()