feat: consolidate env config and add deployment files

- Add debug_font_path, demo_docs_dir, e2e_api_base_url to config.py
- Fix hardcoded paths in pp_structure_debug.py, create_demo_images.py
- Fix hardcoded paths in test files
- Update .env.example with new configuration options
- Update .gitignore to exclude AI development files (.claude/, openspec/, AGENTS.md, CLAUDE.md)
- Add production startup script (start-prod.sh)
- Add README.md with project documentation
- Add 1panel Docker deployment files (docker-compose.yml, Dockerfiles, nginx.conf)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-14 15:02:16 +08:00
parent 858d93155f
commit 86a6633000
31 changed files with 1177 additions and 252 deletions

View File

@@ -12,17 +12,24 @@ Run with: pytest backend/tests/e2e/test_pdf_layout_restoration.py -v -s
import pytest
import requests
import time
import os
from pathlib import Path
from typing import Optional
import json
# Configuration
API_BASE_URL = "http://localhost:8000/api/v2"
DEMO_DOCS_PATH = Path(__file__).parent.parent.parent.parent / "demo_docs"
_default_backend_port = os.getenv("BACKEND_PORT", "8000")
_default_base_url = f"http://localhost:{_default_backend_port}"
_api_base = os.getenv("TOOL_OCR_E2E_API_BASE_URL", _default_base_url).rstrip("/")
API_BASE_URL = f"{_api_base}/api/v2"
DEMO_DOCS_PATH = Path(
os.getenv("TOOL_OCR_DEMO_DOCS_DIR")
or (Path(__file__).resolve().parents[3] / "demo_docs")
)
# Test credentials
TEST_USERNAME = "ymirliu@panjit.com.tw"
TEST_PASSWORD = "4RFV5tgb6yhn"
# Test credentials must be provided via environment variables
TEST_USERNAME = os.getenv("TOOL_OCR_E2E_USERNAME")
TEST_PASSWORD = os.getenv("TOOL_OCR_E2E_PASSWORD")
class TestBase:
@@ -31,6 +38,9 @@ class TestBase:
@pytest.fixture(scope="class")
def auth_token(self):
"""Authenticate and get access token."""
if not TEST_USERNAME or not TEST_PASSWORD:
pytest.skip("Set TOOL_OCR_E2E_USERNAME and TOOL_OCR_E2E_PASSWORD to run E2E tests")
response = requests.post(
f"{API_BASE_URL}/auth/login",
json={