diff options
author | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-23 11:55:20 +0200 |
---|---|---|
committer | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-23 11:55:53 +0200 |
commit | f43b9625e4bf04a4c03a8949c930d623eced02bd (patch) | |
tree | 9d91a3e09fdf7faf48c5b7e04aea0a1f66101022 /service/pixelated | |
parent | 0cca315106906e87ee7694fa860517ca8f248802 (diff) |
Removed crochet, and streamlined the reactor shutdown so we shouldn't see errors on user agent start/exit anymore
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/runserver.py | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/service/pixelated/runserver.py b/service/pixelated/runserver.py index 68eaa840..ebcdc622 100644 --- a/service/pixelated/runserver.py +++ b/service/pixelated/runserver.py @@ -25,17 +25,15 @@ import pixelated.config.credentials_prompt as credentials_prompt import pixelated.bitmask_libraries.register as leap_register import pixelated.config.reactor_manager as reactor_manager import pixelated.support.ext_protobuf # monkey patch for protobuf in OSX +from twisted.internet import error app = Flask(__name__, static_url_path='', static_folder=app_factory.get_static_folder()) def setup(): - try: - args = input_args.parse() - debug_enabled = args.debug or os.environ.get('DEBUG', False) - reactor_manager.start_reactor(logging=debug_enabled) - crochet.setup() + args = input_args.parse() + app.config.update({'HOST': args.host, 'PORT': args.port}) debug_enabled = args.debug or os.environ.get('DEBUG', False) if(not debug_enabled): @@ -43,26 +41,25 @@ def setup(): logger = logging.getLogger('werkzeug') logger.setLevel(logging.INFO) - app.config.update({'HOST': args.host, 'PORT': args.port}) + reactor_manager.start_reactor(logging=debug_enabled) + events_server.ensure_server(port=8090) - if args.register: - server_name, username = args.register - leap_register.register_new_user(username, server_name) + if args.register: + server_name, username = args.register + leap_register.register_new_user(username, server_name) + else: + if args.dispatcher: + raise Exception('Dispatcher mode not implemented yet') + elif args.config is not None: + config_file = os.path.abspath(os.path.expanduser(args.config)) + app.config.from_pyfile(config_file) else: - if args.dispatcher: - raise Exception('Dispatcher mode not implemented yet') - elif args.config is not None: - config_file = os.path.abspath(os.path.expanduser(args.config)) - app.config.from_pyfile(config_file) - else: - provider, user, password = credentials_prompt.run() - app.config['LEAP_SERVER_NAME'] = provider - app.config['LEAP_USERNAME'] = user - app.config['LEAP_PASSWORD'] = password + provider, user, password = credentials_prompt.run() + app.config['LEAP_SERVER_NAME'] = provider + app.config['LEAP_USERNAME'] = user + app.config['LEAP_PASSWORD'] = password - app_factory.create_app(debug_enabled, app) - finally: - reactor_manager.stop_reactor_on_exit() + app_factory.create_app(debug_enabled, app) if __name__ == '__main__': |