From 684a634345844ce7dedc5cc71e4e76425e56f69f Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Mon, 19 Jun 2023 13:23:35 +0300 Subject: [PATCH] Set the `extra` attribute in `FrigateBaseModel.Config` based on the value of the `FRIGATE_EXTRA` environment variable, allowing, ignoring or forbidding extra fields --- frigate/config.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frigate/config.py b/frigate/config.py index f00936533..61e2161f6 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -45,11 +45,13 @@ DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}} class FrigateBaseModel(BaseModel): class Config: - extra = ( - Extra.allow - if os.environ.get("FRIGATE_ALLOW_EXTRA") is not None - else Extra.forbid - ) + frigate_env_extra_var = os.environ.get("FRIGATE_ALLOW_EXTRA", "forbid") + if frigate_env_extra_var.lower() == "allow": + extra = Extra.allow + elif frigate_env_extra_var.lower() == "ignore": + extra = Extra.ignore + else: + extra = Extra.forbid class LiveModeEnum(str, Enum):