class repocribro.config.Config(*args, **kwargs)

Repocribro app configuration container


Check and correct missing mandatory options and sections

Returns:List of errors (string with section and option)
Return type:list of str

Access defaults as property

Returns:Default configuration options
Return type:dict
mark_mandatory(section, option)

Mark some option within section as mandatory

  • section (str) – Section with mandatory option
  • option (str) – Option to be mandatory
read_env(section, option, env_name)

Shorthand for reading ENV variable into config

  • section (str) – Target config section
  • option (str) – Target config option
  • env_name (str) – Name of ENV variable

Shorthand for reading ENV variables with given prefix into config

This will load all ENV variables with given prefix, the section name is after prefix and next underscore so section name can not contain undercore. For example REPOCRIBRO_FLASK_SECRET_KEY will be loaded to section FLASK and option SECRET_KEY (REPOCRIBRO is the prefix).

Parameters:prefix (str) – ENV variable name prefix

All options from flask section will be inserted to config of the given Flask app

Parameters:app (flask.Flask) – Flask application to be configured
repocribro.config.check_config(config, exit_code=1)

Procedure for checking mandatory config

If there are some missing mandatory configurations this procedure prints info on stderr and exits program with specified exit code.

  • config (repocribro.config.Config) – Configuration object
  • exit_code (int) – Exit code on fail


repocribro.config.create_config(cfg_files, env_prefix='REPOCRIBRO')

Factory for making Repocribro config object

Parameters:cfg_files – Single or more config file(s)
Returns:Constructed config object
Return type:repocribro.config.Config