From 77ffefdccb9761b65ed7f83319ddff524172f7a9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 24 Jul 2023 00:48:07 +0200 Subject: [PATCH] Added a `Config.set` method. A useful interface to change configuration values at runtime. --- platypush/config/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platypush/config/__init__.py b/platypush/config/__init__.py index 78748c75a..e11f81d3f 100644 --- a/platypush/config/__init__.py +++ b/platypush/config/__init__.py @@ -483,5 +483,16 @@ class Config: return config.get(key, default) 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: