Configuration manager
Configuration manager is a component of the game coordinator that handles the configuration of the game. It is responsible for loading the configuration from the YAML file and providing it to the game coordinator.
netsecgame.game.configuration_manager.ConfigurationManager
Manages the loading and access of game configuration.
Handles fetching configuration from efficient sources (local file or remote service) and provides structured access to configuration data.
Source code in netsecgame/game/configuration_manager.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
_fetch_remote_configuration
async
Fetches initialization objects from the remote service.
Source code in netsecgame/game/configuration_manager.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
_load_local_configuration
Loads configuration from the local file.
Source code in netsecgame/game/configuration_manager.py
92 93 94 95 96 97 | |
get_all_goal_descriptions
Returns goal descriptions for all roles.
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
Dict[str, str]: The goal descriptions for all roles. |
Source code in netsecgame/game/configuration_manager.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
get_all_max_steps
Returns max steps for all roles.
Returns:
| Type | Description |
|---|---|
Dict[str, Optional[int]]
|
Dict[str, Optional[int]]: A dictionary mapping roles to their maximum steps. |
Source code in netsecgame/game/configuration_manager.py
284 285 286 287 288 289 290 291 292 293 294 295 296 | |
get_all_starting_positions
Returns starting positions for all roles.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The starting positions for all roles. |
Source code in netsecgame/game/configuration_manager.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
get_all_win_conditions
Returns win conditions for all roles.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The win conditions for all roles. |
Source code in netsecgame/game/configuration_manager.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
get_config_hash
Returns the hash of the loaded configuration.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: The hexadecimal hash of the configuration, or None if not loaded. |
Source code in netsecgame/game/configuration_manager.py
112 113 114 115 116 117 118 119 | |
get_cyst_objects
Returns the loaded CYST configuration objects.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Iterable[Any]
|
The CYST configuration objects (usually a list of NodeConfig, etc.). |
Source code in netsecgame/game/configuration_manager.py
103 104 105 106 107 108 109 110 | |
get_goal_description
Returns the goal description for a specific role. Args: role (str): The role of the agent.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The goal description for the specified role. |
Source code in netsecgame/game/configuration_manager.py
145 146 147 148 149 150 151 152 153 154 155 | |
get_max_steps
Returns the max steps for a specific role. Args: role (str): The role of the agent.
Returns:
| Type | Description |
|---|---|
Optional[int]
|
Optional[int]: The max steps for the specified role. |
Source code in netsecgame/game/configuration_manager.py
157 158 159 160 161 162 163 164 165 166 167 | |
get_required_num_players
Returns the required number of players configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_value
|
int
|
The default value for the required number of players. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The required number of players configuration. |
Source code in netsecgame/game/configuration_manager.py
213 214 215 216 217 218 219 220 221 222 223 224 | |
get_rewards
Returns the rewards configuration. Args: reward_names (List[str]): The names of the rewards. default_value (int): The default value for the rewards.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The rewards configuration. |
Source code in netsecgame/game/configuration_manager.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
get_starting_position
Returns the starting position configuration for a specific role. Args: role (str): The role of the agent.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The starting position configuration for the specified role. |
Source code in netsecgame/game/configuration_manager.py
121 122 123 124 125 126 127 128 129 130 131 | |
get_store_trajectories
Returns the store trajectories configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_value
|
bool
|
The default value for the store trajectories. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if trajectories should be stored, False otherwise. |
Source code in netsecgame/game/configuration_manager.py
298 299 300 301 302 303 304 305 306 307 308 309 | |
get_use_dynamic_addresses
Returns the use dynamic addresses configuration. Args: default_value (bool): The default value for the use dynamic addresses.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
The use dynamic addresses configuration. |
Source code in netsecgame/game/configuration_manager.py
189 190 191 192 193 194 195 196 197 198 199 | |
get_use_firewall
Returns the use firewall configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_value
|
bool
|
The default value for the use firewall. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
The use firewall configuration. |
Source code in netsecgame/game/configuration_manager.py
226 227 228 229 230 231 232 233 234 235 236 237 | |
get_use_global_defender
Returns the use global defender configuration. Args: default_value (bool): The default value for the use global defender.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
The use global defender configuration. |
Source code in netsecgame/game/configuration_manager.py
201 202 203 204 205 206 207 208 209 210 211 | |
get_win_conditions
Returns the win conditions for a specific role. Args: role (str): The role of the agent.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Any]
|
The win conditions for the specified role. |
Source code in netsecgame/game/configuration_manager.py
133 134 135 136 137 138 139 140 141 142 143 | |
load
async
Determines the source and loads the configuration. Prioritizes remote service if configured, otherwise falls back to local file.
Source code in netsecgame/game/configuration_manager.py
34 35 36 37 38 39 40 41 42 43 44 45 46 | |