浏览代码

调整配置

develop
H Vs 5 天前
父节点
当前提交
84a0401293
共有 8 个文件被更改,包括 19 次插入23 次删除
  1. +4
    -2
      app/main.py
  2. +4
    -1
      celery_config.py
  3. +2
    -1
      config-dev.json
  4. +2
    -1
      config-production.json
  5. +2
    -1
      config-test.json
  6. +2
    -1
      config.json
  7. +2
    -1
      config.py
  8. +1
    -15
      services/gewe_service.py

+ 4
- 2
app/main.py 查看文件

@@ -142,6 +142,8 @@ async def lifespan(app: FastAPI):
redis_port=conf().get("redis_port") redis_port=conf().get("redis_port")
redis_password=conf().get("redis_password") redis_password=conf().get("redis_password")
redis_db=conf().get("redis_db") redis_db=conf().get("redis_db")
wx_chat_api=conf().get("wx_chat_api")
await redis_service.init(host=redis_host,port=redis_port, password=redis_password, db=redis_db) await redis_service.init(host=redis_host,port=redis_port, password=redis_password, db=redis_db)
app.state.redis_service = redis_service app.state.redis_service = redis_service


@@ -154,7 +156,7 @@ async def lifespan(app: FastAPI):


# 初始化 GeWeChatCom # 初始化 GeWeChatCom
#app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://api.geweapi.com/gewe") #app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://api.geweapi.com/gewe")
app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://218.78.116.24:10883/gewe")
app.state.gewe_service = await GeWeService.get_instance(redis_service,wx_chat_api)
gewe_service=app.state.gewe_service gewe_service=app.state.gewe_service
# # 初始化 GeWeChatCom # # 初始化 GeWeChatCom
#app.state.gwechat_service = GeWeService(app) #app.state.gwechat_service = GeWeService(app)
@@ -184,7 +186,7 @@ async def lifespan(app: FastAPI):
'group_id': KAFKA_GROUP_ID, 'group_id': KAFKA_GROUP_ID,
} }
gewe_config = { gewe_config = {
'api_url': "http://api.geweapi.com/gewe",
'api_url': wx_chat_api,
} }


# Use Celery task # Use Celery task


+ 4
- 1
celery_config.py 查看文件

@@ -18,6 +18,9 @@ redis_password=conf().get("redis_password")
redis_db=conf().get("redis_db") redis_db=conf().get("redis_db")
encoded_password = quote(redis_password) encoded_password = quote(redis_password)



wx_chat_api=conf().get("wx_chat_api")

# 配置 Celery # 配置 Celery
celery_app = Celery( celery_app = Celery(
"worker", "worker",
@@ -53,7 +56,7 @@ kafka_config = {
} }
gewe_config = { gewe_config = {
#'api_url': "http://api.geweapi.com/gewe", #'api_url': "http://api.geweapi.com/gewe",
'api_url':"http://218.78.116.24:10883/gewe",
'api_url':wx_chat_api,
} }






+ 2
- 1
config-dev.json 查看文件

@@ -5,5 +5,6 @@
"redis_password":"telpo#1234", "redis_password":"telpo#1234",
"redis_db":3, "redis_db":3,
"kafka_bootstrap_servers":"192.168.2.121:9092", "kafka_bootstrap_servers":"192.168.2.121:9092",
"aiops_api":"https://id.ssjlai.com/aiopsadmin"
"aiops_api":"https://id.ssjlai.com/aiopsadmin",
"wx_chat_api":"http://api.geweapi.com/gewe"
} }

+ 2
- 1
config-production.json 查看文件

@@ -5,5 +5,6 @@
"redis_password":"telpo#1234", "redis_password":"telpo#1234",
"redis_db":3, "redis_db":3,
"kafka_bootstrap_servers":"172.19.42.40:9092,172.19.42.41:9092,172.19.42.48:9092", "kafka_bootstrap_servers":"172.19.42.40:9092,172.19.42.41:9092,172.19.42.48:9092",
"aiops_api":"https://ai.ssjlai.com/aiopsadmin"
"aiops_api":"https://ai.ssjlai.com/aiopsadmin",
"wx_chat_api":"http://api.geweapi.com/gewe"
} }

+ 2
- 1
config-test.json 查看文件

@@ -5,5 +5,6 @@
"redis_password":"telpo#1234", "redis_password":"telpo#1234",
"redis_db":3, "redis_db":3,
"kafka_bootstrap_servers":"172.19.42.53:9092", "kafka_bootstrap_servers":"172.19.42.53:9092",
"aiops_api":"https://id.ssjlai.com/aiopsadmin"
"aiops_api":"https://id.ssjlai.com/aiopsadmin",
"wx_chat_api":"http://218.78.116.24:10883/gewe"
} }

+ 2
- 1
config.json 查看文件

@@ -5,5 +5,6 @@
"redis_password":"telpo#1234", "redis_password":"telpo#1234",
"redis_db":3, "redis_db":3,
"kafka_bootstrap_servers":"192.168.2.121:9092", "kafka_bootstrap_servers":"192.168.2.121:9092",
"aiops_api":"https://id.ssjlai.com/aiopsadmin"
"aiops_api":"https://id.ssjlai.com/aiopsadmin",
"wx_chat_api":"http://218.78.116.24:10883/gewe"
} }

+ 2
- 1
config.py 查看文件

@@ -25,7 +25,8 @@ available_setting = {
# kafka配置 # kafka配置
"kafka_bootstrap_servers":"", "kafka_bootstrap_servers":"",
# aiops平台 # aiops平台
"aiops_api":""
"aiops_api":"",
"wx_chat_api":""
} }


class Config(dict): class Config(dict):


+ 1
- 15
services/gewe_service.py 查看文件

@@ -41,21 +41,7 @@ class GeWeService:
cls._instance = cls(app,base_url) cls._instance = cls(app,base_url)
return cls._instance return cls._instance


# _instance = None
# def __new__(cls,app:FastAPI,base_url="http://api.geweapi.com/gewe"):
# if not cls._instance:
# cls._instance = super(GeWeService, cls).__new__(cls)
# cls._instance.client = None
# cls._instance.lock_renewal_thread = None
# return cls._instance

# def __init__(self,app:FastAPI,base_url="http://api.geweapi.com/gewe"):
# if not hasattr(self, 'initialized'):
# #self.kafka_service =kafka_service # 获取 KafkaService 单例
# # self.kafka_service =app.state.kafka_service
# self.redis_service=app.state.redis_service
# self.base_url = base_url
# self.initialized = True



############################### 登录模块 ############################### ############################### 登录模块 ###############################
async def check_login_async(self, token_id: str, app_id: str, uuid: str, captch_code: str = ""): async def check_login_async(self, token_id: str, app_id: str, uuid: str, captch_code: str = ""):


正在加载...
取消
保存