Skip to content

Commit

Permalink
Better check for env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Dec 4, 2024
1 parent 7d63223 commit 9b8cfa9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions images/dashboard/src/utils/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def replace_placeholders_and_save(box_name, label_value, seed_data_file_url):
placeholders = re.findall(r"{{(.*?)}}", file_content)
for placeholder in placeholders:
env_var = placeholder.strip()
replacement_value = os.getenv(env_var, "")
if not replacement_value:
replacement_value = os.getenv(env_var, None)
if replacement_value is None:
logging.warning(f"Environment variable {env_var} is not set.")
replacement_value = ""
file_content = file_content.replace(f"{{{{{env_var}}}}}", replacement_value)
with open(values_file, "w") as file:
file.write(file_content)
Expand Down

0 comments on commit 9b8cfa9

Please sign in to comment.