fix(config): resolve config loading path conflicts in universal start.sh (#68, #70)

- 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)
This commit is contained in:
michael 2025-06-22 20:27:11 +02:00
parent bb2bed80a6
commit 010371a9a7

View file

@ -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)