fix: add try_parse_bool for env var strings to enable config overrides of boolean values

This commit is contained in:
Manuel Schmid
2024-06-06 18:05:55 +02:00
parent 04d764820e
commit c4faf2ae6c
2 changed files with 12 additions and 2 deletions
+9
View File
@@ -1,4 +1,6 @@
import os
from ast import literal_eval
def makedirs_with_log(path):
try:
@@ -24,3 +26,10 @@ def get_files_from_folder(folder_path, extensions=None, name_filter=None):
filenames.append(path)
return filenames
def try_parse_bool(value: str) -> str | bool:
value_eval = literal_eval(value.strip().title())
if type(value_eval) is bool:
return value_eval
return value