diff --git a/lib/config.py b/lib/config.py index 545c478..b34e353 100644 --- a/lib/config.py +++ b/lib/config.py @@ -83,6 +83,16 @@ def _config_set_in_scope(scope: dict, key: str, value, cfg_type: type) -> str: elif cfg_type == float: scope[key] = float(value) success = True + elif cfg_type == bool: + value = value.lower() + if value in ('true', '1', 'yes', 'y', 'positive', 'enable', 'en'): + value = True + elif value in ('false', '0', 'no', 'n', 'negative', 'disable', 'dis'): + value = False + else: + return 'Unable to convert given value to a boolean!' + scope[key] = value + success = True except (TypeError, ValueError): success = False if success: