Island,UT: move PACKAGE_CONFIG_PATH and USER_CONFIG_PATH consts to config_setup.py, where they are used

This commit is contained in:
VakarisZ 2021-11-29 15:09:20 +02:00
parent 7e479ec3df
commit 04feb1b31d
3 changed files with 5 additions and 14 deletions

View File

@ -36,9 +36,6 @@ MONGO_EXECUTABLE_PATH = (
)
MONGO_CONNECTION_TIMEOUT = 15
PACKAGE_CONFIG_PATH = Path(MONKEY_ISLAND_ABS_PATH, "cc", SERVER_CONFIG_FILENAME)
USER_CONFIG_PATH = Path(os.getcwd(), SERVER_CONFIG_FILENAME)
DEFAULT_LOG_LEVEL = "INFO"
DEFAULT_START_MONGO_DB = True

View File

@ -1,14 +1,18 @@
import json
import os
from logging import getLogger
from pathlib import Path
from common.utils.file_utils import expand_path
from monkey_island.cc.arg_parser import IslandCmdArgs
from monkey_island.cc.server_utils.consts import PACKAGE_CONFIG_PATH, USER_CONFIG_PATH
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH, SERVER_CONFIG_FILENAME
from monkey_island.cc.setup.island_config_options import IslandConfigOptions
logger = getLogger(__name__)
PACKAGE_CONFIG_PATH = Path(MONKEY_ISLAND_ABS_PATH, "cc", SERVER_CONFIG_FILENAME)
USER_CONFIG_PATH = Path(os.getcwd(), SERVER_CONFIG_FILENAME)
def get_server_config(island_args: IslandCmdArgs) -> IslandConfigOptions:
config = IslandConfigOptions()

View File

@ -1,5 +1,4 @@
import os
import platform
from monkey_island.cc.server_utils import consts
@ -7,12 +6,3 @@ from monkey_island.cc.server_utils import consts
def test_monkey_island_abs_path():
assert consts.MONKEY_ISLAND_ABS_PATH.endswith("monkey_island")
assert os.path.isdir(consts.MONKEY_ISLAND_ABS_PATH)
def test_default_server_config_file_path():
if platform.system() == "Windows":
server_file_path = f"{consts.MONKEY_ISLAND_ABS_PATH}\\cc\\{consts.SERVER_CONFIG_FILENAME}"
else:
server_file_path = f"{consts.MONKEY_ISLAND_ABS_PATH}/cc/{consts.SERVER_CONFIG_FILENAME}"
assert consts.PACKAGE_CONFIG_PATH == server_file_path