mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
移除MQTT,更新launch文档,提供注册表示例文件,更新到0.10.5
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
# 定义配置变量和加载函数
|
||||
import base64
|
||||
import traceback
|
||||
import os
|
||||
@@ -10,7 +7,6 @@ from unilabos.utils import logger
|
||||
|
||||
|
||||
class BasicConfig:
|
||||
ENV = "pro" # 'test'
|
||||
ak = ""
|
||||
sk = ""
|
||||
working_dir = ""
|
||||
@@ -21,12 +17,10 @@ class BasicConfig:
|
||||
machine_name = "undefined"
|
||||
vis_2d_enable = False
|
||||
enable_resource_load = True
|
||||
# 通信协议配置
|
||||
communication_protocol = "mqtt" # 支持: "mqtt", "websocket"
|
||||
communication_protocol = "websocket"
|
||||
|
||||
@classmethod
|
||||
def auth_secret(cls):
|
||||
# base64编码
|
||||
if not cls.ak or not cls.sk:
|
||||
return ""
|
||||
target = f"{cls.ak}:{cls.sk}"
|
||||
@@ -34,25 +28,6 @@ class BasicConfig:
|
||||
return base64_target
|
||||
|
||||
|
||||
# MQTT配置
|
||||
class MQConfig:
|
||||
lab_id = ""
|
||||
instance_id = ""
|
||||
access_key = ""
|
||||
secret_key = ""
|
||||
group_id = ""
|
||||
broker_url = ""
|
||||
port = 1883
|
||||
ca_content = ""
|
||||
cert_content = ""
|
||||
key_content = ""
|
||||
|
||||
# 指定
|
||||
ca_file = "" # 相对config.py所在目录的路径
|
||||
cert_file = "" # 相对config.py所在目录的路径
|
||||
key_file = "" # 相对config.py所在目录的路径
|
||||
|
||||
|
||||
# WebSocket配置
|
||||
class WSConfig:
|
||||
reconnect_interval = 5 # 重连间隔(秒)
|
||||
@@ -94,9 +69,6 @@ def _update_config_from_module(module):
|
||||
for attr in dir(getattr(module, name)):
|
||||
if not attr.startswith("_"):
|
||||
setattr(obj, attr, getattr(getattr(module, name), attr))
|
||||
# 更新OSS认证
|
||||
if len(OSSUploadConfig.authorization) == 0:
|
||||
OSSUploadConfig.authorization = f"Lab {MQConfig.lab_id}"
|
||||
|
||||
def _update_config_from_env():
|
||||
prefix = "UNILABOS_"
|
||||
|
||||
@@ -1 +1,12 @@
|
||||
# 暂无配置
|
||||
# unilabos的配置文件
|
||||
|
||||
class BasicConfig:
|
||||
ak = "" # 实验室网页给您提供的ak代码,您可以在配置文件中指定,也可以通过运行unilabos时以 --ak 传入,优先按照传入参数解析
|
||||
sk = "" # 实验室网页给您提供的sk代码,您可以在配置文件中指定,也可以通过运行unilabos时以 --sk 传入,优先按照传入参数解析
|
||||
|
||||
|
||||
# WebSocket配置,一般无需调整
|
||||
class WSConfig:
|
||||
reconnect_interval = 5 # 重连间隔(秒)
|
||||
max_reconnect_attempts = 999 # 最大重连次数
|
||||
ping_interval = 30 # ping间隔(秒)
|
||||
Reference in New Issue
Block a user