Commit 1b437060 authored by 吴文龙's avatar 吴文龙

使用环境变量配置端口及凭证

parent 664db082
...@@ -17,4 +17,6 @@ services: ...@@ -17,4 +17,6 @@ services:
- NET_ADMIN - NET_ADMIN
environment: environment:
MQTT_PORT: 1883 MQTT_PORT: 1883
TB_MQTT_PORT: 31883
TB_ACCESS_TOKEN: '123456'
FORCE_HTTPS_REDIRECT: "false" FORCE_HTTPS_REDIRECT: "false"
#!/bin/sh #!/bin/sh
echo $@ >> /tmp/all_arguments.txt echo $@ >> /tmp/all_arguments.txt
ip_adr=$(echo $@|awk '{print $3}') ip_adr=$(echo $@|awk '{print $3}')
if mosquitto_pub -h $ip_adr -p 31883 -u 123456 -t v1/devices/me/attributes -f /usr/local/bin/test-mqtt.json -q 1 -d; then if mosquitto_pub -h $ip_adr -p ${TB_MQTT_PORT} -u ${TB_ACCESS_TOKEN} -t v1/devices/me/attributes -f /usr/local/bin/test-mqtt.json -q 1 -d; then
exit 0 exit 0
else else
exit 1 exit 1
......
{"check-mqtt": "ok"} {"check-mqtt-status": "ok"}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment