Skip to content

Commit

Permalink
Island: Update IslandConfigOptions' fields with descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyamalviya committed Aug 13, 2024
1 parent 97b629c commit b910768
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions monkey/monkey_island/cc/setup/island_config_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,52 @@


class MongoDBConfig(InfectionMonkeyBaseModel):
start_mongodb: bool = DEFAULT_START_MONGO_DB
start_mongodb: bool = Field(
default=DEFAULT_START_MONGO_DB,
description="If enabled, the MongoDB server will be started automatically with the Island.",
)


# TODO: rename redundant ssl_certificate_file and split the classes into idividual files
class SSLCertificatesConfig(InfectionMonkeyBaseModel):
ssl_certificate_file: Annotated[
Path, Field(default=Path(DEFAULT_CRT_PATH)), BeforeValidator(expand_path)
Path,
Field(
default=Path(DEFAULT_CRT_PATH),
description="The path to the SSL certificate file that the Island server will use.",
),
BeforeValidator(expand_path),
]
ssl_certificate_key_file: Annotated[
Path, Field(default=Path(DEFAULT_KEY_PATH)), BeforeValidator(expand_path)
Path,
Field(
default=Path(DEFAULT_KEY_PATH),
description="The path to the SSL certificate key file that the Island server will use.",
),
BeforeValidator(expand_path),
]


class IslandConfigOptions(InfectionMonkeyBaseModel):
data_dir: Annotated[Path, Field(default=DEFAULT_DATA_DIR), BeforeValidator(expand_path)]
log_level: str = DEFAULT_LOG_LEVEL
mongodb: MongoDBConfig = MongoDBConfig()
ssl_certificate: SSLCertificatesConfig = SSLCertificatesConfig()
island_port: int = DEFAULT_ISLAND_PORT
data_dir: Annotated[
Path,
Field(
default=DEFAULT_DATA_DIR,
description="The directory where the Island will store runtime artifacts.",
),
BeforeValidator(expand_path),
]
log_level: str = Field(
default=DEFAULT_LOG_LEVEL, description="The threshold for the Island logger."
)
mongodb: MongoDBConfig = Field(
default=MongoDBConfig(), description="The MongoDB configuration for the Island server."
)
ssl_certificate: SSLCertificatesConfig = Field(
default=SSLCertificatesConfig(),
description="The SSL certificates configuration for the Island server.",
)
island_port: int = Field(
default=DEFAULT_ISLAND_PORT,
description="The port on which the Island server should listen.",
)

0 comments on commit b910768

Please sign in to comment.