fix typing issues and fix issue i introduced
This commit is contained in:
parent
59c697e9bf
commit
7a76ecba50
|
@ -20,17 +20,18 @@ 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 and value_from_file.startswith("/run/secrets"):
|
||||
# rewrite variable name: remove _FILE
|
||||
variable_name = variable_name.removesuffix("_FILE")
|
||||
try:
|
||||
with open(value_from_file) as file:
|
||||
value_to_return = file.read().strip() # Read entire content and strip any extra whitespace
|
||||
except FileNotFoundError:
|
||||
value_to_return = None # Handle the case where the file does not exist
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error reading from {value_from_file}: {str(e)}")
|
||||
value_to_return = None # Handle other potential errors
|
||||
if value_from_file:
|
||||
if isinstance(value_from_file, str) and value_from_file.startswith("/run/secrets"):
|
||||
# rewrite variable name: remove _FILE
|
||||
variable_name = variable_name.removesuffix("_FILE")
|
||||
try:
|
||||
with open(value_from_file) as file:
|
||||
value_to_return = file.read().strip() # Read entire content and strip any extra whitespace
|
||||
except FileNotFoundError:
|
||||
value_to_return = None # Handle the case where the file does not exist
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error reading from {value_from_file}: {str(e)}")
|
||||
value_to_return = None # Handle other potential errors
|
||||
|
||||
if value_from_env is not None:
|
||||
if isinstance(default, bool):
|
||||
|
|
|
@ -77,7 +77,7 @@ class ReferenceCacheModel(SpiffworkflowBaseDBModel):
|
|||
file_name: str = db.Column(db.String(255), nullable=False)
|
||||
|
||||
# relative to SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
|
||||
relative_location: int = db.Column(db.String(255), index=True, nullable=False)
|
||||
relative_location: str = db.Column(db.String(255), index=True, nullable=False)
|
||||
|
||||
properties: dict | None = db.Column(db.JSON)
|
||||
# has_lanes = db.Column(db.Boolean())
|
||||
|
|
Loading…
Reference in New Issue