mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Simplify parsing
This commit is contained in:
parent
d398061118
commit
452e06b7fb
@ -261,13 +261,13 @@ def config_set(request: Request, body: AppConfigSetBody):
|
||||
f.close()
|
||||
|
||||
try:
|
||||
update_yaml_from_url(config_file, request.url)
|
||||
update_yaml_from_url(config_file, str(request.url))
|
||||
with open(config_file, "r") as f:
|
||||
new_raw_config = f.read()
|
||||
f.close()
|
||||
# Validate the config schema
|
||||
try:
|
||||
config_obj = FrigateConfig.parse_yaml(new_raw_config)
|
||||
config = FrigateConfig.parse(new_raw_config)
|
||||
except Exception:
|
||||
with open(config_file, "w") as f:
|
||||
f.write(old_raw_config)
|
||||
@ -290,10 +290,8 @@ def config_set(request: Request, body: AppConfigSetBody):
|
||||
)
|
||||
|
||||
if body.requires_restart == 0:
|
||||
request.app.frigate_config = FrigateConfig.parse_object(
|
||||
config_obj, request.app.frigate_config.plus_api
|
||||
)
|
||||
|
||||
request.app.frigate_config = config
|
||||
return JSONResponse(
|
||||
content=(
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user