cosapp.core.config¶
Configuration of CoSApp.
Classes
Encapsulate CoSApp configuration parameters and its handlers. |
- class cosapp.core.config.CoSAppConfiguration[source]¶
Bases:
object
Encapsulate CoSApp configuration parameters and its handlers.
By default, CoSApp configuration folder is stored in - $HOME/.cosapp.d (Linux) - %USERPROFILE%.cosapp.d (MS Windows)
This default configuration folder is overwritten by the environment variable
COSAPP_CONFIG_DIR
.- CONFIG_FILE = 'cosapp_config.json'¶
- COSAPP_CONFIG_DIR = '.cosapp.d'¶
- static config_schema() dict [source]¶
Static method returning the JSON validation schema of the class.
- property roles: FrozenSet[FrozenSet[str]]¶
Roles assigned to user.
- Type:
FrozenSet[FrozenSet[str]]
- property userid: str¶
User ID
- Type:
str
- classmethod validate_file(filename: str | Path) dict [source]¶
Validate the provided file against JSON schema for configuration file.
- Parameters:
filename (str or Path) – Absolute path to the file to be tested.
- Returns:
The dictionary read in the validated file
- Return type:
dict
- Raises:
OSError – If a problem occurs while opening the file.
jsonschema.exceptions.ValidationError – If the provided file does not conform to the JSON schema.