feat(aiot): 边缘告警HTTP上报 + 移除配置中转层
- 新增 edge/report 端点接收边缘端HTTP告警上报 - alarm_event_service 新增 create_from_edge_report 幂等创建 - schemas 新增 EdgeAlarmReport 模型 - 移除 config_service/redis_service/yudao_aiot_config 配置中转 - MQTT 服务标记废弃,告警上报改为HTTP+COS - config 新增 COS/Redis 配置项 - requirements 新增 redis 依赖 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ class AIModelConfig:
|
||||
|
||||
@dataclass
|
||||
class MQTTConfig:
|
||||
"""MQTT 配置"""
|
||||
"""MQTT 配置 (已废弃 - 告警上报已改为 HTTP + COS)"""
|
||||
broker_host: str = "localhost"
|
||||
broker_port: int = 1883
|
||||
client_id: str = "alert_platform"
|
||||
@@ -54,6 +54,18 @@ class MQTTConfig:
|
||||
alert_topic: str = "edge/alert/#"
|
||||
heartbeat_topic: str = "edge/alert/heartbeat/#"
|
||||
qos: int = 1
|
||||
enabled: bool = False # 默认禁用
|
||||
|
||||
|
||||
@dataclass
|
||||
class RedisConfig:
|
||||
"""Redis 配置"""
|
||||
host: str = "localhost"
|
||||
port: int = 6379
|
||||
password: str = ""
|
||||
db: int = 0
|
||||
max_connections: int = 50
|
||||
decode_responses: bool = True
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
@@ -64,6 +76,7 @@ class Settings(BaseModel):
|
||||
app: AppConfig = AppConfig()
|
||||
ai_model: AIModelConfig = AIModelConfig()
|
||||
mqtt: MQTTConfig = MQTTConfig()
|
||||
redis: RedisConfig = RedisConfig()
|
||||
|
||||
|
||||
def load_settings() -> Settings:
|
||||
@@ -104,7 +117,15 @@ def load_settings() -> Settings:
|
||||
alert_topic=os.getenv("MQTT_ALERT_TOPIC", "edge/alert/#"),
|
||||
heartbeat_topic=os.getenv("MQTT_HEARTBEAT_TOPIC", "edge/alert/heartbeat/#"),
|
||||
qos=int(os.getenv("MQTT_QOS", "1")),
|
||||
enabled=os.getenv("MQTT_ENABLED", "true").lower() == "true",
|
||||
enabled=os.getenv("MQTT_ENABLED", "false").lower() == "true",
|
||||
),
|
||||
redis=RedisConfig(
|
||||
host=os.getenv("REDIS_HOST", "localhost"),
|
||||
port=int(os.getenv("REDIS_PORT", "6379")),
|
||||
password=os.getenv("REDIS_PASSWORD", ""),
|
||||
db=int(os.getenv("REDIS_DB", "0")),
|
||||
max_connections=int(os.getenv("REDIS_MAX_CONNECTIONS", "50")),
|
||||
enabled=os.getenv("REDIS_ENABLED", "true").lower() == "true",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user