From 6b7becfe2d33061d0207ce549758ea3ebb0fe22e Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Thu, 23 Apr 2026 12:53:03 +0300 Subject: [PATCH] feat(07-04): update backend/entrypoint.sh with config validation --- backend/entrypoint.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index 36168afe..ff50b676 100755 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -2,11 +2,9 @@ # ============================================================================= # backend/entrypoint.sh # ============================================================================= -# Docker container entrypoint for TFM aInventory backend. -# Runs first-run initialization then starts the application server. -# -# This script is the ENTRYPOINT defined in backend/Dockerfile. -# DATA_DIR and LOGS_DIR are set via docker-compose.yml environment section. +# [D-07] Backend entrypoint - loads config from /app/config/ (YAML format) +# Config sources: /app/config/backend.yaml, /app/config/secrets.yaml, environment variables +# [D-06] Environment variables override YAML config (takes precedence) # ============================================================================= set -euo pipefail @@ -19,11 +17,12 @@ echo "🐳 [Docker] LOGS_DIR=${LOGS_DIR:-/app/logs}" export DATA_DIR="${DATA_DIR:-/app/data}" export LOGS_DIR="${LOGS_DIR:-/app/logs}" -# [D-06] Configuration - Config is loaded from /app/config/ (YAML format) -# System environment variables override YAML config (D-06 load order). -# No inventory.env fallback is used by the backend application. +# Verify config is accessible 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 # Run shared first-run initialization