فهرست منبع

feat: update installer to use source .env file for systemd service

Enhanced the installation script to automatically copy the complete .env
file from the source directory to the installation directory. This ensures
all environment variables (including Qdrant and OpenRouter settings) are
properly configured in the systemd service.

Changes:
- Check for .env file in source/project directory during installation
- Copy complete .env file if it exists (including QDRANT_*, OPENROUTER_*, MCP_* vars)
- Fallback to creating basic .env from prompts if source file doesn't exist
- Display helpful message about required Qdrant/OpenRouter variables when using fallback
- Systemd service already configured to use EnvironmentFile directive

Benefits:
- No need to manually configure environment variables on production server
- All settings from development .env automatically deployed
- Qdrant and embedding services will work immediately after installation
- Maintains backward compatibility with installations without .env file

Usage:
1. Configure .env file in your project directory with all required variables
2. Run installation script - it will automatically copy .env to /opt/webshop-scraper/
3. Systemd service loads all variables via EnvironmentFile directive

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fszontagh 8 ماه پیش
والد
کامیت
d12ca2fbc4
1فایلهای تغییر یافته به همراه23 افزوده شده و 1 حذف شده
  1. 23 1
      scripts/install.sh

+ 23 - 1
scripts/install.sh

@@ -194,12 +194,34 @@ npm install --production
 
 # Create environment file
 echo "Creating environment file..."
-cat > "$INSTALL_DIR/.env" <<EOF
+
+# Check if source .env file exists
+SOURCE_ENV_FILE="$PROJECT_DIR/.env"
+
+if [ -f "$SOURCE_ENV_FILE" ]; then
+    echo "Found .env file in source directory, using it..."
+    # Copy the entire .env file from source
+    cp "$SOURCE_ENV_FILE" "$INSTALL_DIR/.env"
+    echo ".env file copied from source directory"
+else
+    # Fallback to creating from prompted values
+    cat > "$INSTALL_DIR/.env" <<EOF
 API_KEY=$API_KEY
 HOST=$HOST
 PORT=$PORT
 MAX_CONCURRENT_JOBS=$MAX_CONCURRENT_JOBS
 EOF
+    echo ".env file created with basic configuration"
+    echo ""
+    echo "NOTE: For Qdrant and OpenRouter integration, please add these variables to $INSTALL_DIR/.env:"
+    echo "  QDRANT_ENABLED=true"
+    echo "  QDRANT_API_URL=http://your-qdrant-server:6333"
+    echo "  QDRANT_API_KEY=your-qdrant-api-key"
+    echo "  OPENROUTER_API_KEY=your-openrouter-api-key"
+    echo "  MCP_ENABLED=true"
+    echo "  MCP_PORT=3001"
+    echo ""
+fi
 
 # Set permissions
 chmod 600 "$INSTALL_DIR/.env"