Added a Config.set method.

A useful interface to change configuration values at runtime.
This commit is contained in:
Fabio Manganiello 2023-07-24 00:48:07 +02:00
parent dd862db29a
commit 77ffefdccb
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -483,5 +483,16 @@ class Config:
return config.get(key, default) return config.get(key, default)
return config return config
@classmethod
def set(cls, key: str, value: Any):
"""
Set a config value.
:param key: Configuration entry to set.
:param value: New value to set.
"""
# pylint: disable=protected-access
cls._get_instance()._config[key] = value
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et: