mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
add websocket listener config (plain and ssl) (#342)
* add websocket listener config (plain and ssl) * add websocket listener config (plain and ssl) * fix syntax * upversion to 2.0 * introduce changelog for v2.0 * Update Dockerfile
This commit is contained in:
committed by
Pascal Vizeli
parent
e5e8bcd359
commit
829fa7f0f6
4
mosquitto/CHANGELOG.md
Normal file
4
mosquitto/CHANGELOG.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Changelog
|
||||
|
||||
## 2.0
|
||||
- New options to allow clients to connect through websockets
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM %%BASE_IMAGE%%
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM
|
||||
|
||||
# Add env
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Mosquitto broker",
|
||||
"version": "1.0",
|
||||
"version": "2.0",
|
||||
"slug": "mosquitto",
|
||||
"description": "An Open Source MQTT broker",
|
||||
"url": "https://home-assistant.io/addons/mosquitto/",
|
||||
@@ -8,12 +8,16 @@
|
||||
"boot": "auto",
|
||||
"ports": {
|
||||
"1883/tcp": 1883,
|
||||
"8883/tcp": 8883
|
||||
"1884/tcp": 1884,
|
||||
"8883/tcp": 8883,
|
||||
"8884/tcp": 8884
|
||||
},
|
||||
"map": ["ssl", "share"],
|
||||
"options": {
|
||||
"plain": true,
|
||||
"plain_websockets": false,
|
||||
"ssl": false,
|
||||
"ssl_websockets": false,
|
||||
"anonymous": true,
|
||||
"logins": [],
|
||||
"customize": {
|
||||
@@ -25,7 +29,9 @@
|
||||
},
|
||||
"schema": {
|
||||
"plain": "bool",
|
||||
"plain_websockets": "bool",
|
||||
"ssl": "bool",
|
||||
"ssl_websockets": "bool",
|
||||
"anonymous": "bool",
|
||||
"logins": [
|
||||
{"username": "str", "password": "str"}
|
||||
|
||||
@@ -4,7 +4,9 @@ set -e
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
PLAIN=$(jq --raw-output ".plain" $CONFIG_PATH)
|
||||
PLAIN_WS=$(jq --raw-output ".plain_websockets" $CONFIG_PATH)
|
||||
SSL=$(jq --raw-output ".ssl" $CONFIG_PATH)
|
||||
SSL_WS=$(jq --raw-output ".ssl_websockets" $CONFIG_PATH)
|
||||
LOGINS=$(jq --raw-output ".logins | length" $CONFIG_PATH)
|
||||
ANONYMOUS=$(jq --raw-output ".anonymous" $CONFIG_PATH)
|
||||
KEYFILE=$(jq --raw-output ".keyfile" $CONFIG_PATH)
|
||||
@@ -13,10 +15,25 @@ CUSTOMIZE_ACTIVE=$(jq --raw-output ".customize.active" $CONFIG_PATH)
|
||||
|
||||
PLAIN_CONFIG="
|
||||
listener 1883
|
||||
protocol mqtt
|
||||
"
|
||||
|
||||
PLAIN_WS_CONFIG="
|
||||
listener 1884
|
||||
protocol websockets
|
||||
"
|
||||
|
||||
SSL_CONFIG="
|
||||
listener 8883
|
||||
protocol mqtt
|
||||
cafile /ssl/$CERTFILE
|
||||
certfile /ssl/$CERTFILE
|
||||
keyfile /ssl/$KEYFILE
|
||||
"
|
||||
|
||||
SSL_WS_CONFIG="
|
||||
listener 8884
|
||||
protocol websockets
|
||||
cafile /ssl/$CERTFILE
|
||||
certfile /ssl/$CERTFILE
|
||||
keyfile /ssl/$KEYFILE
|
||||
@@ -26,11 +43,17 @@ keyfile /ssl/$KEYFILE
|
||||
if [ "$PLAIN" == "true" ]; then
|
||||
echo "$PLAIN_CONFIG" >> /etc/mosquitto.conf
|
||||
fi
|
||||
if [ "$PLAIN_WS" == "true" ]; then
|
||||
echo "$PLAIN_WS_CONFIG" >> /etc/mosquitto.conf
|
||||
fi
|
||||
|
||||
# Add ssl configs
|
||||
if [ "$SSL" == "true" ]; then
|
||||
echo "$SSL_CONFIG" >> /etc/mosquitto.conf
|
||||
fi
|
||||
if [ "$SSL_WS" == "true" ]; then
|
||||
echo "$SSL_WS_CONFIG" >> /etc/mosquitto.conf
|
||||
fi
|
||||
|
||||
# Allow anonymous connections
|
||||
if [ "$ANONYMOUS" == "false" ]; then
|
||||
|
||||
Reference in New Issue
Block a user