Skip to content

Commit

Permalink
Fix .env.test parser
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Jul 28, 2023
1 parent 2fedcfb commit 3ea8260
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/scripts/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ ENV_PATH="${SCRIPT_DIR}/../.env.test"
if [ -f "${ENV_PATH}" ]; then
echo "🔵 - Loading environment variables from "${ENV_PATH}"..."
# Export env vars
export $(grep -v '^#' ${ENV_PATH} | xargs)
while read -r line || [ -n "$line" ]; do
if echo "$line" | grep -F = &>/dev/null
then
varname=$(echo "$line" | cut -d '=' -f 1)
export "$varname"
fi
done < <(grep -v '^#' "${ENV_PATH}")
else
echo "Error: ${ENV_PATH} does not exist."
exit 1
Expand Down

0 comments on commit 3ea8260

Please sign in to comment.