vantage6.cli.configuration_manager.ServerConfigurationManager#
- class ServerConfigurationManager(name, *args, **kwargs)#
Bases:
ConfigurationManager
Maintains the server’s configuration.
- Parameters:
name (str) – Name of the configuration file.
- __init__(name, *args, **kwargs)#
Methods
__init__
(name, *args, **kwargs)from_file
(path)Create a new instance of the ServerConfigurationManager from a configuration file.
get
()Get a configuration from the configuration manager.
load
(path)Load a configuration from a file.
put
(config)Add a configuration to the configuration manager.
save
(path)Save the configuration to a file.
Attributes
Check if the configuration manager is empty.
- classmethod from_file(path)#
Create a new instance of the ServerConfigurationManager from a configuration file.
- Parameters:
path (str) – Path to the configuration file.
- Returns:
A new instance of the ServerConfigurationManager.
- Return type:
- get()#
Get a configuration from the configuration manager.
- Returns:
The configuration.
- Return type:
- property is_empty: bool#
Check if the configuration manager is empty.
- Returns:
Whether or not the configuration manager is empty.
- Return type:
bool
- load(path)#
Load a configuration from a file.
- Parameters:
path (Path | str) – The path to the file to load the configuration from.
- Return type:
None
- put(config)#
Add a configuration to the configuration manager.
- Parameters:
config (dict) – The configuration to add.
- Raises:
AssertionError – If the configuration is not valid.
- Return type:
None
- save(path)#
Save the configuration to a file.
- Parameters:
path (Path | str) – The path to the file to save the configuration to.
- Return type:
None