35 lines
884 B
Python
35 lines
884 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import logging.config
|
|
import os
|
|
|
|
import yaml
|
|
|
|
|
|
class Config(object):
|
|
def __init__(self) -> None:
|
|
self.reload()
|
|
|
|
def _load_config(self) -> dict:
|
|
pwd = os.path.dirname(os.path.abspath(__file__))
|
|
with open(f"{pwd}/config.yaml", "rb") as fp:
|
|
yconfig = yaml.safe_load(fp)
|
|
return yconfig
|
|
|
|
def reload(self) -> None:
|
|
yconfig = self._load_config()
|
|
|
|
self.CLAUDE = yconfig.get("claude", {})
|
|
self.DEEPSEEK = yconfig.get("deepseek", {})
|
|
self.DOUBAO = yconfig.get("doubao", {})
|
|
|
|
# DB config
|
|
self.mariadb = yconfig.get("db_config", {})
|
|
self.redis = yconfig.get("redis_config", {})
|
|
|
|
# Email config
|
|
self.email = yconfig.get("email_config", {})
|
|
# glances 监控配置
|
|
self.glances = yconfig.get("glances", {})
|