Skip to content

Commit 7c48ce4

Browse files
zakkarrybakerboy448
authored andcommitted
fix(load-env): correct working directory when loading env file
1 parent 556012d commit 7c48ce4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

xseed.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
### ON IMPORT COMPLETE EVENT TYPE IN YOUR SONARR SETTINGS
88

99
# Load environment variables from .env file if it exists
10-
if [ -f ".env" ]; then
10+
# in the same directory as this bash script
11+
12+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
ENV_PATH="$SCRIPT_DIR/.env"
14+
if [ -f "$ENV_PATH" ]; then
1115
# shellcheck source=.env
12-
echo "Loading environment variables from .env file"
13-
source ".env"
16+
echo "Loading environment variables from $ENV_PATH file"
17+
source "$ENV_PATH"
1418
if [ $? -eq 0 ]; then
1519
echo "Environment variables loaded successfully"
1620
else
1721
echo "Error loading environment variables" >&2
1822
exit 1
1923
fi
2024
else
21-
echo ".env file not found"
25+
echo ".env file not found in script directory ($ENV_PATH)"
2226
fi
2327

2428
# Use environment variables with descriptive default values
@@ -86,7 +90,7 @@ detect_application() {
8690
folderPath="$sonarr_episodefile_sourcefolder"
8791
}
8892
# shellcheck disable=SC2154 # These are set by Starr on call
89-
filePath="$sonarr_episodefile_paths"
93+
filePath="$sonarr_episodefile_path"
9094
fi
9195
# shellcheck disable=SC2154 # These are set by Starr on call
9296
eventType="$sonarr_eventtype"

0 commit comments

Comments
 (0)