mirror of
https://github.com/taylanbakircioglu/haproxy-openmanager.git
synced 2026-09-16 15:45:11 +00:00
13179279d6
- Fix frontend port conflict validation to consider bind_address+port combination instead of port-only. HAProxy allows same port on different bind addresses (e.g., bind 10.0.0.1:443 vs bind 10.0.0.2:443). This was blocking frontend edit/save in multi-VIP environments. - Add form field dependency so port re-validates when bind_address changes. - Fix API URL construction using window.location.host instead of hostname to preserve non-standard ports (e.g., :8080), preventing CORS errors in BulkConfigImport. - Make CORS_ORIGINS configurable via environment variable.
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
import os
|
|
from typing import Optional
|
|
|
|
# Database connection settings
|
|
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://haproxy_user:haproxy_password@postgres:5432/haproxy_openmanager")
|
|
|
|
# Redis connection
|
|
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379")
|
|
|
|
# CORS settings
|
|
# Configurable via CORS_ORIGINS env var (comma-separated), e.g. "http://localhost:3000,http://server:8080"
|
|
# Default allows common development and Docker Compose origins
|
|
_cors_env = os.getenv("CORS_ORIGINS", "")
|
|
CORS_ORIGINS = [o.strip() for o in _cors_env.split(",") if o.strip()] if _cors_env else [
|
|
"http://localhost:3000",
|
|
"http://localhost:8080",
|
|
"http://localhost:8000",
|
|
]
|
|
|
|
# Security settings
|
|
SECRET_KEY = os.getenv("SECRET_KEY", "your-secret-key-here")
|
|
JWT_SECRET_KEY = SECRET_KEY # Alias for JWT middleware
|
|
ALGORITHM = "HS256"
|
|
JWT_ALGORITHM = ALGORITHM # Alias for JWT middleware
|
|
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
|
|
|
# Logging level
|
|
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
|
|
|
|
# Public URL configuration (for agent installation scripts)
|
|
PUBLIC_URL = os.getenv("PUBLIC_URL", "http://localhost:8000")
|
|
MANAGEMENT_BASE_URL = os.getenv("MANAGEMENT_BASE_URL", PUBLIC_URL) # Backward compatibility
|
|
|
|
# Agent settings
|
|
AGENT_HEARTBEAT_TIMEOUT_SECONDS = 15
|
|
AGENT_CONFIG_SYNC_INTERVAL_SECONDS = 30
|
|
|
|
# Entity snapshot enabled by default (rollback functionality)
|
|
# Set to "false" only if you need to disable snapshot temporarily
|
|
ENTITY_SNAPSHOT_ENABLED = os.getenv("ENTITY_SNAPSHOT_ENABLED", "true").lower() == "true" |