Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions loopy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

ROOT_PATH="${LOOPY_ROOT_PATH:-$(pwd)}"
export ORIGINAL_DIR=$(pwd)

pushd "$ROOT_PATH" > /dev/null
PYTHONPATH=.:src python ./cmd/loopy.py "$@"
Expand Down
10 changes: 6 additions & 4 deletions src/cli/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ def parse_key_value_pairs(ctx, param, value):
def load_env_file_if_exist(file):
additional_vars = {}
if file is not None:
if os.path.exists(file):
with open(file, "r") as file:
for line in file:
original_dir = os.environ.get("ORIGINAL_DIR", os.getcwd())
input_path = os.path.normpath(os.path.join(original_dir, file))
if os.path.exists(input_path):
with open(input_path, "r") as f:
for line in f:
if not line.strip() or line.startswith("#"): # Skip # part
continue
key, value = line.strip().split("=")
Expand All @@ -153,7 +155,7 @@ def load_env_file_if_exist(file):
else:
additional_vars[key] = value
else:
logger.error(f"File({file}) does not exist")
logger.error(f"File({input_path}) does not exist")
exit(1)
return additional_vars

Expand Down
Loading