Skip to content

Commit

Permalink
fix: check if bridgedata is present (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: RhysyPiece360 <[email protected]>
  • Loading branch information
superintendent2521 and superintendent2521 authored Jan 17, 2024
1 parent da90526 commit f48d2d2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions load_env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
def load_env_vars() -> None: # FIXME: there is a dynamic way to do this
"""Load the environment variables from the config file."""
yaml = YAML()
config_file = "bridgeData.yaml"
template_file = "bridgeData_template.yaml"

if not pathlib.Path("bridgeData.yaml").exists():
raise FileNotFoundError("bridgeData.yaml not found")
if not pathlib.Path(config_file).exists():
if pathlib.Path(template_file).exists():
raise FileNotFoundError(f"{template_file} found. Please set variables and rename it to {config_file}.")
raise FileNotFoundError(f"{config_file} not found")

with open("bridgeData.yaml", encoding="utf-8") as f:
with open(config_file, encoding="utf-8") as f:
config = yaml.load(f)

if "cache_home" in config:
Expand Down

0 comments on commit f48d2d2

Please sign in to comment.