65 lines
1.5 KiB
Bash
Executable File
65 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Prevent active operator-facing startup examples from bypassing required env/profile inputs.
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
cd "$root"
|
|
|
|
targets=(
|
|
README.md
|
|
.env.example
|
|
docker-compose.dev.yml
|
|
deploy/env.example
|
|
deploy/secrets/README.md
|
|
docs/install
|
|
docs/index.md
|
|
docs/installazione-docker-4-contesti.md
|
|
scripts/build-local.sh
|
|
scripts/build-local.ps1
|
|
scripts/docker-smoke.sh
|
|
scripts/preprocess-smoke.sh
|
|
)
|
|
|
|
existing=()
|
|
for target in "${targets[@]}"; do
|
|
[[ ! -e "$target" ]] || existing+=("$target")
|
|
done
|
|
|
|
set +e
|
|
matches="$(rg -n \
|
|
'docker compose (up|build|run|config|ps|exec|-f)|DC="docker compose -f|compose="docker compose -f' \
|
|
"${existing[@]}" 2>&1)"
|
|
rg_status=$?
|
|
set -e
|
|
case "$rg_status" in
|
|
0)
|
|
echo "active deployment command omits --env-file before its action/overrides:" >&2
|
|
printf '%s\n' "$matches" >&2
|
|
exit 1
|
|
;;
|
|
1) ;;
|
|
*)
|
|
printf '%s\n' "$matches" >&2
|
|
exit "$rg_status"
|
|
;;
|
|
esac
|
|
|
|
for document in README.md docs/installazione-docker-4-contesti.md; do
|
|
grep -Fq -- '-f deploy/compose.session-server.yaml.example' "$document" || {
|
|
echo "$document omits the required public-server session override" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
for required in \
|
|
THT_SERVER_WORKSPACE_CONFIG \
|
|
THT_SESSION_RUNTIME_PASSWORD_SOURCE \
|
|
THT_SESSION_MIGRATOR_PASSWORD_SOURCE \
|
|
THT_SESSION_CA_SOURCE; do
|
|
grep -q "^$required=" deploy/env/server.env.example || {
|
|
echo "server env example omits $required" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
echo "deployment command contract passed."
|