Skip to content

Commit

Permalink
Add username and password to mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
miltechniks authored Oct 22, 2024
1 parent efbcc61 commit f4e2067
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wgkex/worker/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def connect(exit_event: threading.Event) -> None:
base_config = get_config().mqtt
broker_address = base_config.broker_url
broker_port = base_config.broker_port
broker_username = base_config.username
broker_password = base_config.password
broker_keepalive = base_config.keepalive
client = mqtt.Client(_HOSTNAME)
domains = get_config().domains
Expand All @@ -51,6 +53,7 @@ def connect(exit_event: threading.Event) -> None:
client.message_callback_add("wireguard/#", on_message_wireguard)
logger.info("connecting to broker %s", broker_address)

client.username_pw_set(broker_username, broker_password)
client.connect(broker_address, port=broker_port, keepalive=broker_keepalive)

# Start background threads that should not be restarted on reconnect
Expand Down

0 comments on commit f4e2067

Please sign in to comment.