Move sensitive config to .env file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,21 +16,29 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Load .env if present
|
||||
if [ -f "$SCRIPT_DIR/.env" ]; then
|
||||
set -a
|
||||
source "$SCRIPT_DIR/.env"
|
||||
set +a
|
||||
fi
|
||||
|
||||
# --- Configuration ---
|
||||
SLSKD_URL="http://localhost:5030"
|
||||
SLSKD_USER="slskd"
|
||||
SLSKD_PASS="slskd"
|
||||
SLSKD_URL="${SLSKD_URL:-http://localhost:5030}"
|
||||
SLSKD_USER="${SLSKD_USER:-slskd}"
|
||||
SLSKD_PASS="${SLSKD_PASS:-slskd}"
|
||||
IDLE_TIMEOUT_MIN="${SLSKD_IDLE_TIMEOUT:-30}"
|
||||
LOG_CHECK_MIN=5
|
||||
CONTAINER_NAME="slskd"
|
||||
|
||||
SCRIPT_DIR="/opt/arr/slskd/scripts"
|
||||
STATE_FILE="$SCRIPT_DIR/.last_active"
|
||||
LOG_FILE="$SCRIPT_DIR/auto-disconnect.log"
|
||||
LOG_MAX_LINES=500
|
||||
|
||||
GOTIFY_URL="https://notify.thecozycat.net"
|
||||
GOTIFY_TOKEN="${SLSKD_GOTIFY_TOKEN:-}"
|
||||
GOTIFY_URL="${GOTIFY_URL:-}"
|
||||
GOTIFY_TOKEN="${GOTIFY_TOKEN:-}"
|
||||
|
||||
# --- Functions ---
|
||||
|
||||
@@ -105,7 +113,7 @@ seconds_since_active() {
|
||||
|
||||
notify() {
|
||||
local msg="$1"
|
||||
if [ -n "$GOTIFY_TOKEN" ]; then
|
||||
if [ -n "$GOTIFY_TOKEN" ] && [ -n "$GOTIFY_URL" ]; then
|
||||
curl -sf --max-time 10 "$GOTIFY_URL/message" -X POST \
|
||||
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
|
||||
-F "title=slskd" \
|
||||
|
||||
Reference in New Issue
Block a user