mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
refactor: Validate all fields before settings them
This commit is contained in:
parent
969b3b1417
commit
3cf368588e
|
@ -139,6 +139,10 @@ class Forgejo(Service):
|
|||
|
||||
@classmethod
|
||||
def set_configuration(cls, config_items):
|
||||
# First, validate the configuration
|
||||
for key, value in config_items.items():
|
||||
if cls.config_items[key].validate_value(value) is False:
|
||||
raise ValueError(f"Value {value} is not valid for {key}")
|
||||
with WriteUserData() as user_data:
|
||||
if "modules" not in user_data:
|
||||
user_data["modules"] = {}
|
||||
|
|
Loading…
Reference in a new issue