web: delete debug
Local Docker Build (Dev) / build-dev (push) Successful in 4s

This commit is contained in:
2025-10-25 15:36:03 -04:00
parent 228053a573
commit 4713bf5ed1
3 changed files with 33 additions and 40 deletions
+30 -37
View File
@@ -11,17 +11,14 @@ from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
# Import existing configuration
from config.settings import config
# Add web interface path for imports
sys.path.append(os.path.join(os.path.dirname(__file__), "nfoguard-web"))
# Import existing database and components
from core.database import NFOGuardDatabase
# Import web routes from existing system
# Import web-specific components
from config.web_settings import web_config as config
from core.web_database import WebDatabase
from api.web_routes import register_web_routes
# Import authentication system
from api.auth import SimpleAuthMiddleware, AuthSession
from api.auth import SimpleAuthMiddleware, create_auth_dependencies
def create_web_app() -> FastAPI:
@@ -105,50 +102,46 @@ def main():
"""Main entry point for NFOGuard Web Interface"""
print("🌐 Starting NFOGuard Web Interface...")
# Use existing config system
web_host = os.environ.get("WEB_HOST", "0.0.0.0")
web_port = int(os.environ.get("WEB_PORT", "8081"))
# Use web config system
web_host = config.web_host
web_port = config.web_port
print(f"📊 Configuration: Port {web_port}")
# Create FastAPI app
app = create_web_app()
# Initialize database using existing system
# Initialize web database (read-only optimized)
try:
db = NFOGuardDatabase(config)
db = WebDatabase(
db_type=config.db_type,
host=config.db_host,
port=config.db_port,
database=config.db_name,
user=config.db_user,
password=config.db_password
)
print(f"✅ Connected to database: {config.db_host}:{config.db_port}/{config.db_name}")
except Exception as e:
print(f"❌ Failed to connect to database: {e}")
sys.exit(1)
# Setup authentication if enabled
auth_enabled = getattr(config, 'web_auth_enabled', False)
session_manager = None
if auth_enabled:
session_timeout = getattr(config, 'web_auth_session_timeout', 3600)
session_manager = AuthSession(timeout_seconds=session_timeout)
print(f"🔐 Web authentication enabled (session timeout: {session_timeout}s)")
else:
print("🌐 Web authentication disabled")
# Create dependencies for dependency injection (simplified for web-only)
# Create dependencies for dependency injection
dependencies = {
"db": db,
"config": config,
"nfo_manager": None, # Not needed for read-only web interface
"movie_processor": None, # Not needed for read-only web interface
"tv_processor": None, # Not needed for read-only web interface
"auth_enabled": auth_enabled,
"session_manager": session_manager
"config": config
}
# Add authentication middleware if enabled (BEFORE routes)
if auth_enabled:
# Pass the session manager to middleware so it uses the same instance
app.add_middleware(SimpleAuthMiddleware, config=config, session_manager=session_manager)
print("🔐 Authentication middleware added to web interface")
# Add authentication dependencies if enabled
if config.web_auth_enabled:
auth_deps = create_auth_dependencies(config)
dependencies.update(auth_deps)
# Add authentication middleware
app.add_middleware(SimpleAuthMiddleware, config=config)
print(f"🔐 Web authentication enabled for user: {config.web_auth_username}")
else:
print("🔓 Web authentication disabled - interface is public")
# Setup static files and routes
setup_static_files(app)