Harden deploy script config handling
This commit is contained in:
@@ -2,8 +2,30 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Safe deploy: never delete server-side runtime data/ files.
|
# Safe deploy: never delete server-side runtime data/ files.
|
||||||
HOST="root@REDACTED"
|
#
|
||||||
TARGET="/home/REDACTED/public_html"
|
# Configuration (required):
|
||||||
|
# DEPLOY_HOST e.g. root@example.com or deploy@example.com
|
||||||
|
# DEPLOY_TARGET e.g. /home/user/web/xmrpay.link/public_html
|
||||||
|
#
|
||||||
|
# Optional local config file (not committed):
|
||||||
|
# scripts/.deploy.env
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
ENV_FILE="$SCRIPT_DIR/.deploy.env"
|
||||||
|
|
||||||
|
if [[ -f "$ENV_FILE" ]]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$ENV_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
HOST="${DEPLOY_HOST:-}"
|
||||||
|
TARGET="${DEPLOY_TARGET:-}"
|
||||||
|
|
||||||
|
if [[ -z "$HOST" || -z "$TARGET" ]]; then
|
||||||
|
echo "Missing deploy configuration." >&2
|
||||||
|
echo "Set DEPLOY_HOST and DEPLOY_TARGET (env vars or scripts/.deploy.env)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
rsync -avz --delete \
|
rsync -avz --delete \
|
||||||
--exclude '.git' \
|
--exclude '.git' \
|
||||||
|
|||||||
Reference in New Issue
Block a user