forked from platypush/platypush
Always use the default configuration values for MQTT listeners if not specified
This commit is contained in:
parent
10d587efd0
commit
7685521e2b
1 changed files with 16 additions and 22 deletions
|
@ -258,29 +258,23 @@ class MqttBackend(Backend):
|
||||||
def add_listeners(self, *listeners):
|
def add_listeners(self, *listeners):
|
||||||
for i, listener in enumerate(listeners):
|
for i, listener in enumerate(listeners):
|
||||||
host = listener.get('host', self.host)
|
host = listener.get('host', self.host)
|
||||||
if host:
|
port = listener.get('port', self.port)
|
||||||
port = listener.get('port', self._default_mqtt_port)
|
username = listener.get('username', self.username)
|
||||||
username = listener.get('username')
|
password = listener.get('password', self.password)
|
||||||
password = listener.get('password')
|
tls_cafile = self._expandpath(listener.get('tls_cafile', self.tls_cafile))
|
||||||
tls_cafile = self._expandpath(listener.get('tls_cafile'))
|
tls_certfile = self._expandpath(
|
||||||
tls_certfile = self._expandpath(listener.get('tls_certfile'))
|
listener.get('tls_certfile', self.tls_certfile)
|
||||||
tls_keyfile = self._expandpath(listener.get('tls_keyfile'))
|
)
|
||||||
tls_version = MQTTPlugin.get_tls_version(listener.get('tls_version'))
|
tls_keyfile = self._expandpath(
|
||||||
tls_ciphers = listener.get('tls_ciphers')
|
listener.get('tls_keyfile', self.tls_keyfile)
|
||||||
tls_insecure = listener.get('tls_insecure')
|
)
|
||||||
else:
|
tls_version = MQTTPlugin.get_tls_version(
|
||||||
host = self.host
|
listener.get('tls_version', self.tls_version)
|
||||||
port = self.port
|
)
|
||||||
username = self.username
|
tls_ciphers = listener.get('tls_ciphers', self.tls_ciphers)
|
||||||
password = self.password
|
tls_insecure = listener.get('tls_insecure', self.tls_insecure)
|
||||||
tls_cafile = self.tls_cafile
|
|
||||||
tls_certfile = self.tls_certfile
|
|
||||||
tls_keyfile = self.tls_keyfile
|
|
||||||
tls_version = self.tls_version
|
|
||||||
tls_ciphers = self.tls_ciphers
|
|
||||||
tls_insecure = self.tls_insecure
|
|
||||||
|
|
||||||
topics = listener.get('topics')
|
topics = listener.get('topics')
|
||||||
|
|
||||||
if not topics:
|
if not topics:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
'No list of topics specified for listener n.%d', i + 1
|
'No list of topics specified for listener n.%d', i + 1
|
||||||
|
|
Loading…
Reference in a new issue