From 010371a9a7109c03d2c49d285f4008a5defb935b Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 22 Jun 2025 20:27:11 +0200 Subject: [PATCH] fix(config): resolve config loading path conflicts in universal start.sh (#68, #70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split REPO_ROOT and PROJECT_DIR for different purposes - REPO_ROOT: Repository-wide configs (.env, system configs) - PROJECT_DIR: Lua-specific working directory (src/, cd) - Fix config detection across development and production environments Changes: - REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" # 2 levels up for .env - PROJECT_DIR="$(dirname "$SCRIPT_DIR")" # 1 level up for src/ - Config loading uses REPO_ROOT (.env location) - Working directory and Lua paths use PROJECT_DIR (furt-lua/) Tested on: - karl (Linux/Development): .env loading + lua51 execution ✅ - walter (OpenBSD/Production): system config + lua execution ✅ Cross-platform SMTP functionality verified: - karl: Full E2E test with successful mail delivery - walter: HTTP server + config detection working Fixes #68 (Universal Config Detection) Fixes #70 (karl start.sh regression after universal script update) --- furt-lua/scripts/start.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/furt-lua/scripts/start.sh b/furt-lua/scripts/start.sh index cda613d..7d1498f 100755 --- a/furt-lua/scripts/start.sh +++ b/furt-lua/scripts/start.sh @@ -12,7 +12,8 @@ NC='\033[0m' # No Color # Script directory (POSIX-compatible) SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PROJECT_DIR="$(dirname "$SCRIPT_DIR")" +PROJECT_DIR="$(dirname "$SCRIPT_DIR")" # für src/, cd +REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" # für .env echo -e "${GREEN}=== Furt Lua HTTP-Server Startup ===${NC}" @@ -21,9 +22,9 @@ echo -e "${YELLOW}Checking dependencies...${NC}" # Load environment variables - Universal Config Detection echo -e "${YELLOW}Loading environment variables...${NC}" -if [ -f "$PROJECT_DIR/.env" ]; then - echo -e "${GREEN}[OK]${NC} Loading from $PROJECT_DIR/.env" - export $(grep -v '^#' "$PROJECT_DIR/.env" | grep -v '^$' | xargs) +if [ -f "$REPO_ROOT/.env" ]; then + echo -e "${GREEN}[OK]${NC} Loading from $REPO_ROOT/.env" + export $(grep -v '^#' "$REPO_ROOT/.env" | grep -v '^$' | xargs) elif [ -f "/usr/local/etc/furt/environment" ]; then echo -e "${GREEN}[OK]${NC} Loading from /usr/local/etc/furt/environment" export $(grep -v '^#' /usr/local/etc/furt/environment | grep -v '^$' | xargs)