Checkpoint: Le garde-fou de stockage distingue désormais les environnements : les serveurs Santinova exigent explicitement REQUIRE_STORAGE_VOLUME=true et bloquent sans volume PDF monté, tandis que l’hébergement cloud crée le répertoire local nécessaire sans arrêter le démarrage. Les tests, TypeScript, build et une sonde de démarrage cloud sont validés.
This commit is contained in:
@@ -5,20 +5,27 @@
|
||||
set -eu
|
||||
|
||||
storage_path="${STORAGE_BASE_PATH:-/app/storage}"
|
||||
require_storage_volume="${REQUIRE_STORAGE_VOLUME:-false}"
|
||||
|
||||
if [ ! -d "$storage_path" ]; then
|
||||
echo "[StorageGuard] Répertoire de stockage absent : $storage_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "$require_storage_volume" = "true" ]; then
|
||||
if [ ! -d "$storage_path" ]; then
|
||||
echo "[StorageGuard] Répertoire de stockage absent : $storage_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! awk -v expected="$storage_path" '$2 == expected { mounted = 1 } END { exit mounted ? 0 : 1 }' /proc/mounts; then
|
||||
echo "[StorageGuard] Volume persistant non monté sur $storage_path ; démarrage annulé." >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! awk -v expected="$storage_path" '$2 == expected { mounted = 1 } END { exit mounted ? 0 : 1 }' /proc/mounts; then
|
||||
echo "[StorageGuard] Volume persistant non monté sur $storage_path ; démarrage annulé." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w "$storage_path" ]; then
|
||||
echo "[StorageGuard] Volume persistant non inscriptible : $storage_path" >&2
|
||||
exit 1
|
||||
if [ ! -w "$storage_path" ]; then
|
||||
echo "[StorageGuard] Volume persistant non inscriptible : $storage_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# L’hébergement cloud n’expose pas de volume Docker local. Il utilise le
|
||||
# stockage applicatif disponible à l’exécution et doit donc pouvoir démarrer.
|
||||
mkdir -p "$storage_path"
|
||||
fi
|
||||
|
||||
exec node dist/index.js
|
||||
|
||||
Reference in New Issue
Block a user