Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PurnenduMIshra129th committed Dec 29, 2024
1 parent b9da888 commit fb166f6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions example/linux/systemd/Talawa-api.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# Description: Talawa API startup script

# Use environment variable for project path, with a default fallback(eg./path/to/your/talawa-api replace with original path if TALAWA_API_HOME will not set then it will use default path.Important ! always use fallback path)
Expand Down Expand Up @@ -129,11 +130,13 @@ fi
echo ".env file found in '$pwd' directory. Proceeding..." | tee -a "$LOG_FILE"

# Load environment variables from .env file securely
while IFS= read -r line || [ -n "$line" ]; do
if [[ "$line" =~ ^NODE_ENV= ]]; then
export "$line"
fi
done < .env
NODE_ENV=$(grep '^NODE_ENV=' .env | cut -d '=' -f2)
if [ -n "$NODE_ENV" ]; then
export NODE_ENV
else
echo "Error: NODE_ENV not found in .env file" | tee -a "$LOG_FILE"
exit 1
fi

# Check if NODE_ENV is set
if [ -z "$NODE_ENV" ]; then
Expand Down

0 comments on commit fb166f6

Please sign in to comment.