diff --git a/monkey/monkey_island/cc/setup/config_setup.py b/monkey/monkey_island/cc/setup/config_setup.py index 3621ea7fc..d1e3e984b 100644 --- a/monkey/monkey_island/cc/setup/config_setup.py +++ b/monkey/monkey_island/cc/setup/config_setup.py @@ -4,7 +4,7 @@ from monkey_island.cc.arg_parser import IslandCmdArgs from monkey_island.cc.environment import server_config_handler from monkey_island.cc.environment.utils import create_secure_directory from monkey_island.cc.server_utils import file_utils -from monkey_island.cc.server_utils.consts import DEFAULT_DATA_DIR, DEFAULT_SERVER_CONFIG_PATH +from monkey_island.cc.server_utils.consts import DEFAULT_SERVER_CONFIG_PATH from monkey_island.cc.setup.island_config_options import IslandConfigOptions @@ -23,8 +23,12 @@ def _setup_config_by_cmd_arg(server_config_path) -> Tuple[IslandConfigOptions, s def _setup_default_config() -> Tuple[IslandConfigOptions, str]: - server_config_path = DEFAULT_SERVER_CONFIG_PATH - create_secure_directory(DEFAULT_DATA_DIR, create_parent_dirs=False) - server_config_handler.create_default_server_config_file() + default_config = server_config_handler.load_server_config_from_file(DEFAULT_SERVER_CONFIG_PATH) + default_data_dir = default_config.data_dir + + create_secure_directory(default_data_dir, create_parent_dirs=False) + + server_config_path = server_config_handler.create_default_server_config_file(default_data_dir) config = server_config_handler.load_server_config_from_file(server_config_path) + return config, server_config_path