Skip to content

Commit

Permalink
Merge pull request #77 from skrapi/master
Browse files Browse the repository at this point in the history
Moved CLIENT_ID check in init_app
  • Loading branch information
stlehmann authored Sep 18, 2020
2 parents 2b036fb + 178c645 commit d00e3d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flask_mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def __init__(

def init_app(self, app: Flask) -> None:
"""Init the Flask-MQTT addon."""

if "MQTT_CLIENT_ID" in app.config:
self.client_id = app.config["MQTT_CLIENT_ID"]

if isinstance(self.client_id, unicode):
self.client._client_id = self.client_id.encode("utf-8")
else:
Expand All @@ -116,9 +120,6 @@ def init_app(self, app: Flask) -> None:
self.client.on_connect = self._handle_connect
self.client.on_disconnect = self._handle_disconnect

if "MQTT_CLIENT_ID" in app.config:
self.client_id = app.config["MQTT_CLIENT_ID"]

if "MQTT_CLEAN_SESSION" in app.config:
self.clean_session = app.config["MQTT_CLEAN_SESSION"]

Expand Down

0 comments on commit d00e3d2

Please sign in to comment.