feat(07-04): update backend/entrypoint.sh with config validation
This commit is contained in:
@@ -2,11 +2,9 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
# backend/entrypoint.sh
|
# backend/entrypoint.sh
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Docker container entrypoint for TFM aInventory backend.
|
# [D-07] Backend entrypoint - loads config from /app/config/ (YAML format)
|
||||||
# Runs first-run initialization then starts the application server.
|
# Config sources: /app/config/backend.yaml, /app/config/secrets.yaml, environment variables
|
||||||
#
|
# [D-06] Environment variables override YAML config (takes precedence)
|
||||||
# This script is the ENTRYPOINT defined in backend/Dockerfile.
|
|
||||||
# DATA_DIR and LOGS_DIR are set via docker-compose.yml environment section.
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -19,11 +17,12 @@ echo "🐳 [Docker] LOGS_DIR=${LOGS_DIR:-/app/logs}"
|
|||||||
export DATA_DIR="${DATA_DIR:-/app/data}"
|
export DATA_DIR="${DATA_DIR:-/app/data}"
|
||||||
export LOGS_DIR="${LOGS_DIR:-/app/logs}"
|
export LOGS_DIR="${LOGS_DIR:-/app/logs}"
|
||||||
|
|
||||||
# [D-06] Configuration - Config is loaded from /app/config/ (YAML format)
|
# Verify config is accessible
|
||||||
# System environment variables override YAML config (D-06 load order).
|
|
||||||
# No inventory.env fallback is used by the backend application.
|
|
||||||
if [ ! -f "/app/config/backend.yaml" ]; then
|
if [ ! -f "/app/config/backend.yaml" ]; then
|
||||||
echo "⚠️ [Docker] WARNING: /app/config/backend.yaml not found! Using defaults."
|
echo "❌ [Docker] ERROR: /app/config/backend.yaml not found!"
|
||||||
|
echo "❌ [Docker] Config must be mounted from host at /app/config/ (read-only)"
|
||||||
|
echo "❌ [Docker] See config/README.md for setup instructions"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run shared first-run initialization
|
# Run shared first-run initialization
|
||||||
|
|||||||
Reference in New Issue
Block a user