forked from p34709852/monkey
island: Change _expand_path() from a static to regular function
_expand_path() is a utility function used by IslandConfigOptions. It doesn't need to be part of the class. It can potentially be reused by other modules that require the same functionality.
This commit is contained in:
parent
f0a109a145
commit
e4866b1286
|
@ -14,9 +14,7 @@ from monkey_island.cc.server_utils.consts import (
|
|||
|
||||
class IslandConfigOptions:
|
||||
def __init__(self, config_contents: dict):
|
||||
self.data_dir = IslandConfigOptions._expand_path(
|
||||
config_contents.get("data_dir", DEFAULT_DATA_DIR)
|
||||
)
|
||||
self.data_dir = _expand_path(config_contents.get("data_dir", DEFAULT_DATA_DIR))
|
||||
|
||||
self.log_level = config_contents.get("log_level", DEFAULT_LOG_LEVEL)
|
||||
|
||||
|
@ -24,17 +22,17 @@ class IslandConfigOptions:
|
|||
"mongodb", {"start_mongodb": DEFAULT_START_MONGO_DB}
|
||||
).get("start_mongodb", DEFAULT_START_MONGO_DB)
|
||||
|
||||
self.crt_path = IslandConfigOptions._expand_path(
|
||||
self.crt_path = _expand_path(
|
||||
config_contents.get("ssl_certificate", DEFAULT_CERTIFICATE_PATHS).get(
|
||||
"ssl_certificate_file", DEFAULT_CRT_PATH
|
||||
)
|
||||
)
|
||||
self.key_path = IslandConfigOptions._expand_path(
|
||||
self.key_path = _expand_path(
|
||||
config_contents.get("ssl_certificate", DEFAULT_CERTIFICATE_PATHS).get(
|
||||
"ssl_certificate_key_file", DEFAULT_KEY_PATH
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _expand_path(path: str) -> str:
|
||||
return os.path.expandvars(os.path.expanduser(path))
|
||||
|
||||
def _expand_path(path: str) -> str:
|
||||
return os.path.expandvars(os.path.expanduser(path))
|
||||
|
|
Loading…
Reference in New Issue