mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
Set the extra attribute in FrigateBaseModel.Config based on the value of the FRIGATE_EXTRA environment variable, allowing, ignoring or forbidding extra fields
This commit is contained in:
parent
a29c4dccfb
commit
684a634345
@ -45,11 +45,13 @@ DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
|
|||||||
|
|
||||||
class FrigateBaseModel(BaseModel):
|
class FrigateBaseModel(BaseModel):
|
||||||
class Config:
|
class Config:
|
||||||
extra = (
|
frigate_env_extra_var = os.environ.get("FRIGATE_ALLOW_EXTRA", "forbid")
|
||||||
Extra.allow
|
if frigate_env_extra_var.lower() == "allow":
|
||||||
if os.environ.get("FRIGATE_ALLOW_EXTRA") is not None
|
extra = Extra.allow
|
||||||
else Extra.forbid
|
elif frigate_env_extra_var.lower() == "ignore":
|
||||||
)
|
extra = Extra.ignore
|
||||||
|
else:
|
||||||
|
extra = Extra.forbid
|
||||||
|
|
||||||
|
|
||||||
class LiveModeEnum(str, Enum):
|
class LiveModeEnum(str, Enum):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user