#!/usr/bin/with-contenv bash

if [ -z "$UPTIME_KUMA_URL" ] || [ -z "$UPTIME_KUMA_USERNAME" ] || [ -z "$UPTIME_KUMA_PASSWORD" ]; then
    echo "[mod-auto-uptime-kuma] Missing required environment variables. Please refer to the Readme, skipping..."
    exit 0
fi

echo "[mod-auto-uptime-kuma] Executing SWAG auto-uptime-kuma mod"

scriptPath='/app/auto-uptime-kuma.py'

if [ -e "$scriptPath" ] && [ ! -x "$scriptPath" ]; then
    chmod +x "$scriptPath"
fi

python3 $scriptPath
