From d7c57f5023cbc5e07cd09f93f8258980bc349052 Mon Sep 17 00:00:00 2001 From: haohao <1036606149@qq.com> Date: Sun, 8 Jun 2025 21:03:02 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91gateway=20=E6=96=B0=E5=A2=9E=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 53 +++++++++++++++++++ .../src/main/resources/application.yaml | 35 ++++++------ 2 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application-local.yaml diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application-local.yaml b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application-local.yaml new file mode 100644 index 0000000000..282434315b --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application-local.yaml @@ -0,0 +1,53 @@ +server: + port: 8090 # IoT 网关服务端口 + +--- #################### 消息队列相关 #################### + +# rocketmq 配置项,对应 RocketMQProperties 配置类 +rocketmq: + name-server: 127.0.0.1:9876 # RocketMQ Namesrv + +--- #################### IoT 网关相关配置 #################### + +yudao: + iot: + # 网关配置 + gateway: + # 设备 RPC 配置 + rpc: + url: http://127.0.0.1:48080 # 主程序 API 地址 + # 设备 Token 配置 + token: + secret: yudaoIotGatewayTokenSecret123456789 # Token 密钥,至少32位 + + # 协议配置 + protocol: + # ==================================== + # 针对引入的 HTTP 组件的配置 + # ==================================== + http: + server-port: 8092 + # ==================================== + # 针对引入的 EMQX 组件的配置 + # ==================================== + emqx: + mqtt-host: 127.0.0.1 # MQTT Broker 地址 + mqtt-port: 1883 # MQTT Broker 端口 + mqtt-username: admin # MQTT 用户名 + mqtt-password: public # MQTT 密码 + auth-port: 8101 # 认证端口 + + # 消息总线配置 + message-bus: + type: rocketmq # 本地开发使用 RocketMQ + +--- #################### 日志相关配置 #################### + +# 开发环境日志配置 +logging: + level: + # 开发环境详细日志 + cn.iocoder.yudao.module.iot.gateway.protocol.mqtt: DEBUG + cn.iocoder.yudao.module.iot.gateway.protocol.http: DEBUG + # MQTT 客户端日志 + io.vertx.mqtt: DEBUG \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml index 0f52fda62d..b57cc266d1 100644 --- a/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml +++ b/yudao-module-iot/yudao-module-iot-gateway/src/main/resources/application.yaml @@ -1,17 +1,18 @@ spring: application: name: iot-gateway-server + profiles: + active: local # 默认激活本地开发环境 --- #################### 消息队列相关 #################### # rocketmq 配置项,对应 RocketMQProperties 配置类 rocketmq: - name-server: 127.0.0.1:9876 # RocketMQ Namesrv # Producer 配置项 producer: group: ${spring.application.name}_PRODUCER # 生产者分组 ---- #################### 芋道相关配置 #################### +--- #################### IoT 网关相关配置 #################### yudao: iot: @@ -19,12 +20,10 @@ yudao: gateway: # 设备 RPC 配置 rpc: - url: http://127.0.0.1:48080 # 主程序 API 地址 connect-timeout: 30s read-timeout: 30s # 设备 Token 配置 token: - secret: 1234567890123456789012345678901 expiration: 7d # 协议配置 @@ -34,28 +33,34 @@ yudao: # ==================================== http: enabled: true - server-port: 8092 # ==================================== # 针对引入的 EMQX 组件的配置 # ==================================== emqx: - enabled: true - mqtt-host: 127.0.0.1 - mqtt-port: 1883 - mqtt-username: admin - mqtt-password: admin123 + enabled: false mqtt-ssl: false mqtt-topics: - - "/sys/#" - auth-port: 8101 + - "/sys/#" # 系统主题(设备上报) + - "/ota/#" # OTA 升级主题 + - "/config/#" # 配置主题 # 消息总线配置 message-bus: type: rocketmq # 消息总线的类型 -# 日志配置 -# TODO 芋艿:是不是可以删除 +--- #################### 日志相关配置 #################### + +# 基础日志配置 logging: + file: + name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 level: - cn.iocoder.yudao: INFO + # 应用基础日志级别 + cn.iocoder.yudao.module.iot.gateway: INFO + org.springframework.boot: INFO + # RocketMQ 日志 + org.apache.rocketmq: WARN + # 根日志级别 root: INFO + +debug: false