cosapp.core.config

Configuration of CoSApp.

Classes

CoSAppConfiguration()

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.

static get_config_dir() Path[source]
classmethod get_config_filename() Path[source]
property roles: FrozenSet[FrozenSet[str]]

Roles assigned to user.

Type:

FrozenSet[FrozenSet[str]]

update_configuration() None[source]

Update current user configuration file.

update_userid() None[source]

Update current user id.

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.