fix(): AttributeError: 'NoneType' object has no attribute 'startswith'

This commit is contained in:
Chris Daßler 2024-05-26 20:19:59 +02:00
parent 998e08ee6e
commit 84a47e0efd

View File

@ -18,7 +18,7 @@ def config_from_env(variable_name: str, *, default: str | bool | int | None = No
# using docker secrets - put file contents to env value
if variable_name.endswith("_FILE"):
value_from_file = default if value_from_env is None else value_from_env
if value_from_file.startswith("/run/secrets"):
if value_from_file and value_from_file.startswith("/run/secrets"):
# rewrite variable name: remove _FILE
variable_name = variable_name.removesuffix("_FILE")