From 5032588c23630369ee1d21f53b161e34ba1e9ab8 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 20 Sep 2022 17:07:28 +0530 Subject: [PATCH] Island: Initialize MongoDB connection before DI container so that repositories using mongo can be registered and subscribed --- monkey/monkey_island/cc/server_setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/server_setup.py b/monkey/monkey_island/cc/server_setup.py index 4b31de5ce..710d45465 100644 --- a/monkey/monkey_island/cc/server_setup.py +++ b/monkey/monkey_island/cc/server_setup.py @@ -65,12 +65,14 @@ def run_monkey_island(): ip_addresses, deployment, version = _collect_system_info() _send_analytics(deployment, version) + + _initialize_mongodb_connection(config_options.start_mongodb, config_options.data_dir) + container = _initialize_di_container(ip_addresses, version, config_options.data_dir) setup_island_event_handlers(container) setup_agent_event_handlers(container) _setup_agent_event_serializers(container) - _initialize_mongodb_connection(config_options.start_mongodb, config_options.data_dir) _start_island_server(ip_addresses, island_args.setup_only, config_options, container)