certwrangler.utils module#

class certwrangler.utils.LogLevels(*values)[source]#

Bases: IntEnum

An Enum representing the supported log levels.

debug#
info#
warning#
error#
critical#
class certwrangler.utils.CertwranglerState(config_path: Path = PosixPath('/github/home/.config/certwrangler.yaml'), config: Config | None = None)[source]#

Bases: object

The main state of the application. This class is responsible for loading the config from disk, setting up logging, and storing config passed in from CLI options.

config_path: Path#

A pathlib.Path object referencing the location of the config file. Defaults to ‘${XDG_CONFIG_HOME}/certwrangler.yaml’ or ‘~/.config/certwrangler.yaml’ if ‘${XDG_CONFIG_HOME}’ is not set.

daemon: Daemon#

The instance of certwrangler.daemon.Daemon.

config: Config | None#

The loaded instance of certwrangler.models.Config, populated by load_config().

resolver: Resolver#

The instance of dns.resolver.Resolver used for all DNS operations.

lock: RLock#

Resource lock for making changes to the state.

_log_level: LogLevels#
_loggers: List[Logger]#
property log_level: LogLevels#
load_config(initialize: bool = False) None[source]#

Loads the config from config_path and optionally initializes it. This also cascades the change to the metrics system to reconcile the entities in the metrics registries.

Parameters:

initialize – If True, certwrangler.models.Config.initialize() will be called on CertwranglerState.config after loading.

Raises:

ConfigError – Raised on any issues with loading, parsing, or initializing the config.