fix source command

This commit is contained in:
2026-03-22 12:15:11 +01:00
parent cdc2ce5d05
commit 9771fc620e
2 changed files with 13 additions and 4 deletions

View File

@@ -4,14 +4,23 @@ set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# ------------------------------------------------------------------
# Load config
# Load config (safe parser — only loads KEY=VALUE lines)
# ------------------------------------------------------------------
if [ ! -f "$REPO_ROOT/.env" ]; then
echo "ERROR: $REPO_ROOT/.env not found. Copy .env.example and fill in values."
exit 1
fi
source "$REPO_ROOT/.env"
DATA_ROOT="${DATA_ROOT:-/opt/docker-data}"
set -a
eval "$(grep -v '^#' "$REPO_ROOT/.env" | grep -v '^$' | grep '^[A-Za-z_][A-Za-z_0-9]*=' )"
set +a
# Validate required variables
for var in DOMAIN DATA_ROOT; do
if [ -z "${!var:-}" ]; then
echo "ERROR: $var is not set in .env"
exit 1
fi
done
echo "==> VPS info:"
cat /etc/os-release