Fixes: 1) Ensure get_parameters handles missing configuration keys gracefully by adding a check for None values;
Extra: Update `cache.get` default value in `get_parameters` method for better safety.
This commit is contained in:
parent
20b4efec90
commit
e7a859ad0a
1 changed files with 3 additions and 1 deletions
|
|
@ -139,10 +139,12 @@ def get_project_parameters() -> Any:
|
||||||
configuration source, formats their keys to lowercase, and then stores
|
configuration source, formats their keys to lowercase, and then stores
|
||||||
them in the cache for a limited period.
|
them in the cache for a limited period.
|
||||||
"""
|
"""
|
||||||
parameters = cache.get("parameters")
|
parameters = cache.get("parameters", {})
|
||||||
|
|
||||||
if not parameters:
|
if not parameters:
|
||||||
for key in EXPOSABLE_KEYS:
|
for key in EXPOSABLE_KEYS:
|
||||||
|
if not getattr(config, key):
|
||||||
|
continue
|
||||||
parameters[key.lower()] = getattr(config, key)
|
parameters[key.lower()] = getattr(config, key)
|
||||||
|
|
||||||
cache.set("parameters", parameters, 60 * 60)
|
cache.set("parameters", parameters, 60 * 60)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue