forked from p15670423/monkey
Catch and print errors instead of creating a default server config
This commit is contained in:
parent
805ab989b9
commit
3c7687a405
|
@ -6,9 +6,7 @@ gevent_monkey.patch_all()
|
|||
|
||||
import json # noqa: E402
|
||||
import os # noqa: E402
|
||||
from pathlib import Path # noqa: E402
|
||||
|
||||
import monkey_island.cc.environment.server_config_generator as server_config_generator # noqa: E402
|
||||
from monkey_island.cc.server_utils.consts import DEFAULT_DATA_DIR, DEFAULT_LOG_LEVEL # noqa: E402
|
||||
from monkey_island.cc.server_utils.island_logger import setup_logging # noqa: E402
|
||||
|
||||
|
@ -19,9 +17,6 @@ if "__main__" == __name__:
|
|||
# imports, so the log init needs to be first.
|
||||
try:
|
||||
server_config_path = os.path.expanduser(island_args.server_config)
|
||||
if not Path(server_config_path).is_file():
|
||||
server_config_generator.create_default_config_file(server_config_path)
|
||||
|
||||
with open(server_config_path, "r") as f:
|
||||
config_content = f.read()
|
||||
data = json.loads(config_content)
|
||||
|
@ -34,8 +29,12 @@ if "__main__" == __name__:
|
|||
|
||||
setup_logging(data_dir, log_level)
|
||||
|
||||
except OSError as ex:
|
||||
print(f"Error opening server config file: {ex}")
|
||||
exit(1)
|
||||
|
||||
except json.JSONDecodeError as ex:
|
||||
print(f"Error loading logging config: {ex}")
|
||||
print(f"Error loading server config: {ex}")
|
||||
exit(1)
|
||||
|
||||
from monkey_island.cc.main import main # noqa: E402
|
||||
|
|
Loading…
Reference in New Issue