Initial commit
This commit is contained in:
36
backend/app/runtime.py
Normal file
36
backend/app/runtime.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from .config import settings
|
||||
from .db import get_settings_overrides
|
||||
|
||||
_INT_FIELDS = {
|
||||
"sonarr_quality_profile_id",
|
||||
"radarr_quality_profile_id",
|
||||
"jwt_exp_minutes",
|
||||
"requests_sync_ttl_minutes",
|
||||
"requests_poll_interval_seconds",
|
||||
"requests_delta_sync_interval_minutes",
|
||||
"requests_cleanup_days",
|
||||
}
|
||||
_BOOL_FIELDS = {
|
||||
"jellyfin_sync_to_arr",
|
||||
}
|
||||
|
||||
|
||||
def get_runtime_settings():
|
||||
overrides = get_settings_overrides()
|
||||
update = {}
|
||||
for key, value in overrides.items():
|
||||
if value is None:
|
||||
continue
|
||||
if key in _INT_FIELDS:
|
||||
try:
|
||||
update[key] = int(value)
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
elif key in _BOOL_FIELDS:
|
||||
if isinstance(value, bool):
|
||||
update[key] = value
|
||||
else:
|
||||
update[key] = str(value).strip().lower() in {"1", "true", "yes", "on"}
|
||||
else:
|
||||
update[key] = value
|
||||
return settings.model_copy(update=update)
|
||||
Reference in New Issue
Block a user