Files
haproxy-openmanager/backend/config.py
T
taylanbakircioglu b8326cc4d4 fix(snapshot): Enable entity snapshot by default
Changed ENTITY_SNAPSHOT_ENABLED default from false to true.

Reasoning:
- Code is tested and deployed to production
- Backward compatibility verified
- No need for gradual rollout with feature flag
- Entity rollback should work by default
- Users expect reject to rollback entities (not just status change)

Feature flag still exists for emergency disable if needed:
- Set ENTITY_SNAPSHOT_ENABLED=false to disable
- Useful for troubleshooting or rollback scenarios

Default behavior (ENTITY_SNAPSHOT_ENABLED=true):
- Entity update creates snapshot in metadata
- Reject operation rolls back entities to old values
- Bulk import reject deletes new entities, restores updated ones
- Restore reject returns to pre-restore state
2025-11-14 01:06:38 +03:00

33 lines
1.1 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
CORS_ORIGINS = ["http://localhost:3000"]
# 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"