fix: fixed the problem of separating website

This commit is contained in:
Leonard Excoffier
2024-09-07 17:53:34 -04:00
parent 5286790281
commit b2284316a9
2 changed files with 5 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
FROM debian
# Set required environment variables
ENV WEBSITES='("google.com" "yahoo.com")'
ENV WEBSITES="google.com,yahoo.com"
ENV WEBHOOK_URL=""
ENV DISCORD_ID=""

View File

@@ -9,8 +9,11 @@ send_discord_notification() {
"$WEBHOOK_URL"
}
# Split the comma-separated string of websites into a proper list
IFS=',' read -ra website_array <<< "$WEBSITES"
# Loop through the websites and check their status
for website in "${$WEBSITES[@]}"; do
for website in "${website_array[@]}"; do
response=$(curl -s -o /dev/null -L -w "%{http_code}" --max-time 10 --connect-timeout 5 --insecure "$website")
if [ "$response" != "200" ]; then