(fix) proxy - fix when STORE_MODEL_IN_DB should be set (#6492)

* set store_model_in_db at the top

* correctly use store_model_in_db global
This commit is contained in:
Ishaan Jaff 2024-10-29 21:28:14 +05:30 committed by GitHub
parent 441adad3ae
commit 8e19a31d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 5 deletions

View file

@ -67,6 +67,29 @@ def get_secret_str(
return value
def get_secret_bool(
secret_name: str,
default_value: Optional[bool] = None,
) -> Optional[bool]:
"""
Guarantees response from 'get_secret' is either boolean or none. Used for fixing linting errors.
Args:
secret_name: The name of the secret to get.
default_value: The default value to return if the secret is not found.
Returns:
The secret value as a boolean or None if the secret is not found.
"""
_secret_value = get_secret(secret_name, default_value)
if _secret_value is None:
return None
elif isinstance(_secret_value, bool):
return _secret_value
else:
return str_to_bool(_secret_value)
def get_secret( # noqa: PLR0915
secret_name: str,
default_value: Optional[Union[str, bool]] = None,