diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..585b45176 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.7 + +# Copy files +ADD . /app +RUN cp /app/data/configuration.yaml /app +RUN cp /app/docker/run.sh /app +RUN chmod +x /app/run.sh +WORKDIR /app + +# Write .hash.json +ARG COMMIT +RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json + +# Install dependencies +RUN apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \ + npm install --unsafe-perm && \ + apk del make gcc g++ python linux-headers udev git + +# Entrypoint +ENTRYPOINT ["./run.sh"] diff --git a/data/configuration.yaml b/data/configuration.yaml index 3ed7c1ce0..f9fbadcf0 100644 --- a/data/configuration.yaml +++ b/data/configuration.yaml @@ -13,6 +13,7 @@ mqtt: # MQTT server authentication, uncomment if required: # user: my_user # password: my_password + # selfsigned: false # Serial settings serial: diff --git a/lib/mqtt.js b/lib/mqtt.js index 9f7450a8e..e486fa0ee 100644 --- a/lib/mqtt.js +++ b/lib/mqtt.js @@ -22,6 +22,11 @@ class MQTT { logger.debug(`Using MQTT client ID: '${mqttSettings.client_id}'`); options.clientId = mqttSettings.client_id; } + + if (mqttSettings.selfsigned) { + logger.debug(`Using Self Signed Cert. Ignoring warnings.`); + options.rejectUnauthorized = false; + } this.client = mqtt.connect(mqttSettings.server, options);