cgnal.core.config package
Module contents
Implementation of classes that parse configuration files.
- class cgnal.core.config.AuthConfig(config: cfg_load.Configuration)
Bases:
cgnal.core.config.BaseConfig
Authetication configuration.
Class instance initializer.
- Parameters
config – configuration
- property filename: Union[str, os.PathLike[str]]
Return the name of the file containing the authentication details.
- Returns
name of the file containing the authentication details
- property method: str
Return the authentication method.
- Returns
authentication method
- property password: str
Return the password.
- Returns
password
- property user: str
Return the user name.
- Returns
user name
- class cgnal.core.config.AuthService(config: cfg_load.Configuration)
Bases:
cgnal.core.config.BaseConfig
Configuration for the authentication data.
Class instance initializer.
- Parameters
config – configuration
- property check: str
Return check.
- Returns
check
- property decode: str
Return decode.
- Returns
decode
- property url: str
Return the url of the authentication service.
- Returns
url of the authentication service
- class cgnal.core.config.AuthenticationServiceConfig(config: cfg_load.Configuration)
Bases:
cgnal.core.config.BaseConfig
Configuration of the authentication service.
Class instance initializer.
- Parameters
config – configuration
- property ap_name: str
Return the ap name.
- Returns
ap name
- property auth_service: cgnal.core.config.AuthService
Return the authentication data.
- Returns
authentication data
- property check_service: cgnal.core.config.CheckService
Return the check service configuration.
- Returns
check service configuration
- property cors: str
Return the cors.
- Returns
cors
- property jwt_free_endpoints: List[str]
Return the jwt free endpoints.
- Returns
jwt free endpoints
- property secured: bool
Return the secured flag.
- Returns
secured flag
- class cgnal.core.config.BaseConfig(config: cfg_load.Configuration)
Bases:
object
Base configuration class.
Class instance initializer.
- Parameters
config – configuration
- getValue(name: Hashable) Any
Get the value of a configuration node.
- Parameters
name – name of the configuration node
- Returns
value of the configuratio node
- safeGetValue(name: Hashable) Any
Get the value of a configuration node, gracefully returning None if the node does not exist.
- Parameters
name – name of the node
- Returns
value of the node, or None if the node does not exist
- sublevel(name: Hashable) cfg_load.Configuration
Return a sublevel of the main configuration.
- Parameters
name – name of the sublevel
- Returns
configuration of the sublevel
- update(my_dict: dict) cgnal.core.config.BaseConfig
Update the current configuration.
- Parameters
my_dict – dictionary containing the nodes of the configuration to be updated
- Returns
new configuration with the updated nodes
- class cgnal.core.config.CheckService(config: cfg_load.Configuration)
Bases:
cgnal.core.config.BaseConfig
Configuration for the check service.
Class instance initializer.
- Parameters
config – configuration
- property login: str
Return the login url.
- Returns
login url
- property logout: str
Return the logout url.
- Returns
logout url
- property url: str
Return the url of the check service.
- Returns
url of the check service.
- class cgnal.core.config.FileSystemConfig(config: cfg_load.Configuration)
Bases:
cgnal.core.config.BaseConfig
Configuration for file system paths.
Class instance initializer.
- Parameters
config – configuration
- getFile(file: Hashable) Union[str, os.PathLike[str]]
Return the file name.
- Parameters
file – name of the configuration node
- Returns
file name
- getFolder(path: Hashable) Union[str, os.PathLike[str]]
Return the folder name.
- Parameters
path – name of the configuration node
- Returns
folder name
- property root: Union[str, os.PathLike[str]]
Return the root node value.
- Returns
root node value
- cgnal.core.config.get_all_configuration_file(application_file: Union[str, os.PathLike[str]] = 'application.yml', name_env: str = 'CONFIG_FILE') Sequence[str]
Retrieve all configuration files from system path, including the one in environment variable.
- Parameters
application_file – name of the configuration file to retrieve
name_env – environment variable specifying the path to a specific configuration file
- Returns
list of retrieved paths
- cgnal.core.config.joinPath(loader: Union[yaml.loader.Loader, yaml.loader.FullLoader, yaml.loader.UnsafeLoader], node: yaml.nodes.Node) Union[str, os.PathLike[str]]
Join pieces of a file system path. Can be used as a custom tag handler.
- Parameters
loader – YAML file loader
node – YAML node
- Returns
path
- cgnal.core.config.load(filename: Union[str, os.PathLike[str]]) cfg_load.Configuration
Load configuration reading given filename.
- Parameters
filename – file to read
- Returns
loaded configuration
- cgnal.core.config.merge_confs(filenames: Sequence[Union[str, os.PathLike[str]]], default: Optional[str] = 'defaults.yml') cfg_load.Configuration
Merge configurations in given files.
- Parameters
filenames – files to merge
default – default configurations
- Returns
merged configuration
- cgnal.core.config.path_constructor(loader: Union[yaml.loader.Loader, yaml.loader.FullLoader, yaml.loader.UnsafeLoader], node: yaml.nodes.Node) Union[str, os.PathLike[str]]
Extract the matched value, expand env variable, and replace the match.
- Parameters
loader – not used
node – YAML node
- Returns
path
- Raises
SyntaxError – if the node value does not match the regex expression for a path-like string
KeyError – raises an exception if the environment variable is missing