From 743c88f98bd28fa7a9f97da43802f7077517e08c Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:32:47 +0200 Subject: [PATCH] Enforce boolean validation --- stacosys/conf/config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stacosys/conf/config.py b/stacosys/conf/config.py index 8b8c0a2..e942bb2 100644 --- a/stacosys/conf/config.py +++ b/stacosys/conf/config.py @@ -2,12 +2,12 @@ # -*- coding: utf-8 -*- from enum import Enum + import profig class ConfigParameter(Enum): DB_SQLITE_FILE = "main.db_sqlite_file" - DB_BACKUP_JSON_FILE = "main.db_backup_json_file" LANG = "main.lang" COMMENT_POLLING = "main.newcomment_polling" @@ -62,7 +62,9 @@ class Config: return int(self._params[key.value]) def get_bool(self, key: ConfigParameter): - return self._params[key.value].lower() in ("yes", "true") + value = self._params[key.value].lower() + assert value in ("yes", "true", "no", "false") + return value in ("yes", "true") def __repr__(self): - return self._params.__repr__() \ No newline at end of file + return self._params.__repr__()