diff options
Diffstat (limited to 'service/pixelated/config')
-rw-r--r-- | service/pixelated/config/__init__.py | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/service/pixelated/config/__init__.py b/service/pixelated/config/__init__.py index 2072278d..1b966744 100644 --- a/service/pixelated/config/__init__.py +++ b/service/pixelated/config/__init__.py @@ -36,42 +36,44 @@ import pixelated.support.ext_protobuf import pixelated.support.ext_sqlcipher import pixelated.support.ext_esmtp_sender_factory import pixelated.support.ext_fetch +import pixelated.support.ext_keymanager_fetch_key def initialize(): - args = parse_args() - app = App() + with monkey_patch_leap_fetch_keys(): + args = parse_args() + app = App() - init_logging(args) - init_leap_cert(args) + init_logging(args) + init_leap_cert(args) - if args.register: - register(*args.register[::-1]) - sys.exit(0) + if args.register: + register(*args.register[::-1]) + sys.exit(0) - if args.dispatcher or args.dispatcher_stdin: - config_dispatcher(app, args) - else: - config_user_agent(app, args) + if args.dispatcher or args.dispatcher_stdin: + config_dispatcher(app, args) + else: + config_user_agent(app, args) - init_events_server() + init_events_server() - def load_app(): - # welcome to deferred hell. Or maybe you'll be welcomed later, who knows. - loading_app = loading(args) + def load_app(): + # welcome to deferred hell. Or maybe you'll be welcomed later, who knows. + loading_app = loading(args) - def init_soledad(): - return init_soledad_and_user_key(app, args.home) + def init_soledad(): + return init_soledad_and_user_key(app, args.home) - def stop_loading_app(leap_session): - d = loading_app.stopListening() - d.addCallback(partial(start_user_agent_app, leap_session)) + def stop_loading_app(leap_session): + d = loading_app.stopListening() + d.addCallback(partial(start_user_agent_app, leap_session)) - def start_user_agent_app(leap_session, _): - app_factory.create_app(app, args, leap_session) + def start_user_agent_app(leap_session, _): + app_factory.create_app(app, args, leap_session) - d = deferToThread(init_soledad) - d.addCallback(stop_loading_app) + d = deferToThread(init_soledad) + d.addCallback(stop_loading_app) - reactor.callWhenRunning(load_app) - reactor.run() + reactor.callWhenRunning(load_app) + reactor.run() |