Skip to content

Commit

Permalink
Support MQTT authentication. Koenkk#2
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Apr 11, 2018
1 parent 2cfd078 commit 0055302
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ if (!settings.devices) {

// Setup client
console.log(`Connecting to MQTT server at ${settings.mqtt.server}`)
const client = mqtt.connect(settings.mqtt.server)

const options = {};
if (settings.mqtt.user && settings.mqtt.password) {
options.username = settings.mqtt.user;
options.password = settings.mqtt.password;
}

const client = mqtt.connect(settings.mqtt.server, options)
const shepherd = new ZShepherd(
settings.serial.port,
{
Expand Down

0 comments on commit 0055302

Please sign in to comment.