Update config/settings.py
Browse files- config/settings.py +13 -12
config/settings.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
"""
|
| 2 |
ARF Settings Configuration with Pydantic 2.x Compatibility
|
| 3 |
-
Fixed for both OSS and Enterprise deployments
|
| 4 |
"""
|
| 5 |
import os
|
| 6 |
import sys
|
|
@@ -50,7 +50,7 @@ class InstallationStatus(str, Enum):
|
|
| 50 |
# Pydantic 2.x compatible Settings class
|
| 51 |
if PYDANTIC_V2:
|
| 52 |
class Settings(BaseSettings):
|
| 53 |
-
"""ARF Settings with Pydantic 2.x compatibility"""
|
| 54 |
model_config = SettingsConfigDict(
|
| 55 |
env_file=".env",
|
| 56 |
env_file_encoding="utf-8",
|
|
@@ -65,8 +65,8 @@ if PYDANTIC_V2:
|
|
| 65 |
debug: bool = Field(default=False, description="Enable debug logging")
|
| 66 |
log_level: str = Field(default="INFO", description="Logging level")
|
| 67 |
|
| 68 |
-
# Version Info
|
| 69 |
-
arf_version: str = Field(default="3.3.
|
| 70 |
demo_version: str = Field(default="3.8.0", description="Demo app version")
|
| 71 |
|
| 72 |
# Installation Status
|
|
@@ -102,7 +102,7 @@ if PYDANTIC_V2:
|
|
| 102 |
default_currency: str = Field(default="USD", description="Default currency")
|
| 103 |
cost_per_incident: float = Field(default=10000.0, description="Default cost per incident")
|
| 104 |
engineer_hourly_rate: float = Field(default=150.0, description="Engineer hourly rate")
|
| 105 |
-
engineer_annual_cost: float = Field(default=200000.0, description="Engineer annual cost")
|
| 106 |
|
| 107 |
@model_validator(mode='before')
|
| 108 |
@classmethod
|
|
@@ -161,7 +161,7 @@ if PYDANTIC_V2:
|
|
| 161 |
else:
|
| 162 |
# Pydantic v1 compatible Settings class
|
| 163 |
class Settings(BaseSettings):
|
| 164 |
-
"""ARF Settings with Pydantic v1 compatibility"""
|
| 165 |
class Config:
|
| 166 |
env_file = ".env"
|
| 167 |
env_file_encoding = "utf-8"
|
|
@@ -174,8 +174,8 @@ else:
|
|
| 174 |
debug: bool = Field(default=False, description="Enable debug logging")
|
| 175 |
log_level: str = Field(default="INFO", description="Logging level")
|
| 176 |
|
| 177 |
-
# Version Info
|
| 178 |
-
arf_version: str = Field(default="3.3.
|
| 179 |
demo_version: str = Field(default="3.8.0", description="Demo app version")
|
| 180 |
|
| 181 |
# Installation Status
|
|
@@ -211,7 +211,7 @@ else:
|
|
| 211 |
default_currency: str = Field(default="USD", description="Default currency")
|
| 212 |
cost_per_incident: float = Field(default=10000.0, description="Default cost per incident")
|
| 213 |
engineer_hourly_rate: float = Field(default=150.0, description="Engineer hourly rate")
|
| 214 |
-
engineer_annual_cost: float = Field(default=200000.0, description="Engineer annual cost")
|
| 215 |
|
| 216 |
@validator('arf_mode', 'safety_mode', 'installation_status', pre=True)
|
| 217 |
def validate_enum_strings(cls, v, field):
|
|
@@ -268,15 +268,16 @@ try:
|
|
| 268 |
logger.info(f"📊 ARF Mode: {settings.arf_mode}")
|
| 269 |
logger.info(f"🛡️ Safety Mode: {settings.safety_mode}")
|
| 270 |
logger.info(f"📦 Installation Status: {settings.installation_status}")
|
|
|
|
| 271 |
except Exception as e:
|
| 272 |
logger.error(f"❌ Failed to initialize settings: {e}")
|
| 273 |
-
# Create fallback settings
|
| 274 |
class FallbackSettings:
|
| 275 |
arf_mode = ARFMode.DEMO
|
| 276 |
safety_mode = SafetyMode.STANDARD
|
| 277 |
debug = False
|
| 278 |
log_level = "INFO"
|
| 279 |
-
arf_version = "3.3.
|
| 280 |
demo_version = "3.8.0"
|
| 281 |
oss_installed = False
|
| 282 |
enterprise_installed = False
|
|
@@ -297,7 +298,7 @@ except Exception as e:
|
|
| 297 |
default_currency = "USD"
|
| 298 |
cost_per_incident = 10000.0
|
| 299 |
engineer_hourly_rate = 150.0
|
| 300 |
-
engineer_annual_cost = 200000.0
|
| 301 |
|
| 302 |
settings = FallbackSettings()
|
| 303 |
logger.warning("⚠️ Using fallback settings due to initialization error")
|
|
|
|
| 1 |
"""
|
| 2 |
ARF Settings Configuration with Pydantic 2.x Compatibility
|
| 3 |
+
Fixed for both OSS and Enterprise deployments - FIXED VERSION CONSISTENCY
|
| 4 |
"""
|
| 5 |
import os
|
| 6 |
import sys
|
|
|
|
| 50 |
# Pydantic 2.x compatible Settings class
|
| 51 |
if PYDANTIC_V2:
|
| 52 |
class Settings(BaseSettings):
|
| 53 |
+
"""ARF Settings with Pydantic 2.x compatibility - FIXED: Version consistency"""
|
| 54 |
model_config = SettingsConfigDict(
|
| 55 |
env_file=".env",
|
| 56 |
env_file_encoding="utf-8",
|
|
|
|
| 65 |
debug: bool = Field(default=False, description="Enable debug logging")
|
| 66 |
log_level: str = Field(default="INFO", description="Logging level")
|
| 67 |
|
| 68 |
+
# Version Info - FIXED: Updated to v3.3.9 (actual PyPI version)
|
| 69 |
+
arf_version: str = Field(default="3.3.9", description="ARF version")
|
| 70 |
demo_version: str = Field(default="3.8.0", description="Demo app version")
|
| 71 |
|
| 72 |
# Installation Status
|
|
|
|
| 102 |
default_currency: str = Field(default="USD", description="Default currency")
|
| 103 |
cost_per_incident: float = Field(default=10000.0, description="Default cost per incident")
|
| 104 |
engineer_hourly_rate: float = Field(default=150.0, description="Engineer hourly rate")
|
| 105 |
+
engineer_annual_cost: float = Field(default=200000.0, description="Engineer annual cost")
|
| 106 |
|
| 107 |
@model_validator(mode='before')
|
| 108 |
@classmethod
|
|
|
|
| 161 |
else:
|
| 162 |
# Pydantic v1 compatible Settings class
|
| 163 |
class Settings(BaseSettings):
|
| 164 |
+
"""ARF Settings with Pydantic v1 compatibility - FIXED: Version consistency"""
|
| 165 |
class Config:
|
| 166 |
env_file = ".env"
|
| 167 |
env_file_encoding = "utf-8"
|
|
|
|
| 174 |
debug: bool = Field(default=False, description="Enable debug logging")
|
| 175 |
log_level: str = Field(default="INFO", description="Logging level")
|
| 176 |
|
| 177 |
+
# Version Info - FIXED: Updated to v3.3.9 (actual PyPI version)
|
| 178 |
+
arf_version: str = Field(default="3.3.9", description="ARF version")
|
| 179 |
demo_version: str = Field(default="3.8.0", description="Demo app version")
|
| 180 |
|
| 181 |
# Installation Status
|
|
|
|
| 211 |
default_currency: str = Field(default="USD", description="Default currency")
|
| 212 |
cost_per_incident: float = Field(default=10000.0, description="Default cost per incident")
|
| 213 |
engineer_hourly_rate: float = Field(default=150.0, description="Engineer hourly rate")
|
| 214 |
+
engineer_annual_cost: float = Field(default=200000.0, description="Engineer annual cost")
|
| 215 |
|
| 216 |
@validator('arf_mode', 'safety_mode', 'installation_status', pre=True)
|
| 217 |
def validate_enum_strings(cls, v, field):
|
|
|
|
| 268 |
logger.info(f"📊 ARF Mode: {settings.arf_mode}")
|
| 269 |
logger.info(f"🛡️ Safety Mode: {settings.safety_mode}")
|
| 270 |
logger.info(f"📦 Installation Status: {settings.installation_status}")
|
| 271 |
+
logger.info(f"🔖 ARF Version: {settings.arf_version}") # Added version logging
|
| 272 |
except Exception as e:
|
| 273 |
logger.error(f"❌ Failed to initialize settings: {e}")
|
| 274 |
+
# Create fallback settings - FIXED: Updated version to 3.3.9
|
| 275 |
class FallbackSettings:
|
| 276 |
arf_mode = ARFMode.DEMO
|
| 277 |
safety_mode = SafetyMode.STANDARD
|
| 278 |
debug = False
|
| 279 |
log_level = "INFO"
|
| 280 |
+
arf_version = "3.3.9" # FIXED: Updated from 3.3.7 to 3.3.9
|
| 281 |
demo_version = "3.8.0"
|
| 282 |
oss_installed = False
|
| 283 |
enterprise_installed = False
|
|
|
|
| 298 |
default_currency = "USD"
|
| 299 |
cost_per_incident = 10000.0
|
| 300 |
engineer_hourly_rate = 150.0
|
| 301 |
+
engineer_annual_cost = 200000.0
|
| 302 |
|
| 303 |
settings = FallbackSettings()
|
| 304 |
logger.warning("⚠️ Using fallback settings due to initialization error")
|