mqtt password
This commit is contained in:
6
.env
6
.env
@@ -4,10 +4,10 @@
|
|||||||
DATABASE_URL=postgresql://luna:123luna@121.43.104.161:6432/luna
|
DATABASE_URL=postgresql://luna:123luna@121.43.104.161:6432/luna
|
||||||
|
|
||||||
# MQTT配置
|
# MQTT配置
|
||||||
MQTT_BROKER_HOST=localhost
|
MQTT_BROKER_HOST=luna-mqtt
|
||||||
MQTT_BROKER_PORT=1883
|
MQTT_BROKER_PORT=1883
|
||||||
# MQTT_USERNAME=
|
MQTT_USERNAME=luna2025
|
||||||
# MQTT_PASSWORD=
|
MQTT_PASSWORD=123luna2021
|
||||||
|
|
||||||
# 应用配置
|
# 应用配置
|
||||||
APP_NAME=墨水屏桌面屏幕系统
|
APP_NAME=墨水屏桌面屏幕系统
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ DATABASE_URL=postgresql://luna:123luna@121.43.104.161:6432/luna
|
|||||||
# MQTT配置 - 使用Docker内部服务名
|
# MQTT配置 - 使用Docker内部服务名
|
||||||
MQTT_BROKER_HOST=luna-mqtt
|
MQTT_BROKER_HOST=luna-mqtt
|
||||||
MQTT_BROKER_PORT=1883
|
MQTT_BROKER_PORT=1883
|
||||||
# MQTT_USERNAME=
|
MQTT_USERNAME=luna2025
|
||||||
# MQTT_PASSWORD=
|
MQTT_PASSWORD=123luna2021
|
||||||
|
|
||||||
# 应用配置
|
# 应用配置
|
||||||
APP_NAME=墨水屏桌面屏幕系统
|
APP_NAME=墨水屏桌面屏幕系统
|
||||||
@@ -23,7 +23,7 @@ INK_WIDTH=400
|
|||||||
INK_HEIGHT=300
|
INK_HEIGHT=300
|
||||||
|
|
||||||
# 安全配置
|
# 安全配置
|
||||||
SECRET_KEY=your-secret-key-change-in-production
|
SECRET_KEY=123quant-speed
|
||||||
ALGORITHM=HS256
|
ALGORITHM=HS256
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ services:
|
|||||||
- "1883:1883"
|
- "1883:1883"
|
||||||
- "9001:9001"
|
- "9001:9001"
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf
|
||||||
- mosquitto_data:/mosquitto/data
|
- mosquitto_data:/mosquitto/data
|
||||||
- mosquitto_logs:/mosquitto/log
|
- mosquitto_logs:/mosquitto/log
|
||||||
|
- mosquitto_config:/mosquitto/config
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- luna-network
|
- luna-network
|
||||||
@@ -35,6 +37,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
mosquitto_data:
|
mosquitto_data:
|
||||||
mosquitto_logs:
|
mosquitto_logs:
|
||||||
|
mosquitto_config:
|
||||||
|
|
||||||
# 网络
|
# 网络
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
10
mosquitto.conf
Normal file
10
mosquitto.conf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Mosquitto配置文件
|
||||||
|
|
||||||
|
# 监听端口
|
||||||
|
listener 1883
|
||||||
|
|
||||||
|
# 允许匿名连接(默认为true,我们将设置为false以要求认证)
|
||||||
|
allow_anonymous false
|
||||||
|
|
||||||
|
# 密码文件
|
||||||
|
password_file /mosquitto/config/passwd
|
||||||
11
setup_mqtt_auth.sh
Executable file
11
setup_mqtt_auth.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 创建MQTT密码文件
|
||||||
|
docker exec luna-mqtt mosquitto_passwd -c -b /mosquitto/config/passwd luna2025 123luna2021
|
||||||
|
|
||||||
|
# 重启MQTT服务以应用新的认证配置
|
||||||
|
docker restart luna-mqtt
|
||||||
|
|
||||||
|
echo "MQTT用户名和密码已配置完成"
|
||||||
|
echo "用户名: luna2025"
|
||||||
|
echo "密码: 123luna2021"
|
||||||
Reference in New Issue
Block a user