Skip to content

Per-broker MQTT topic templates - #33

Merged
tuzzmaniandevil merged 1 commit into
devfrom
feat/mqtt-topic-templates
Oct 9, 2026
Merged

tuzzmaniandevil merged 1 commit into
devfrom
feat/mqtt-topic-templates

Conversation

@tuzzmaniandevil

Copy link
Copy Markdown
Contributor

Ports OwlShack's per-broker topic templates.

  • packetTopic / statusTopic on a broker, with {iata} {pubkey} {name} and meshcoretomqtt's uppercase tokens ({IATA}, {PUBLIC_KEY}, ...). Same placeholder set as OwlShack.
  • Unset keeps today's <topicPrefix>/{iata}/{pubkey}/packets|status, so existing configs publish exactly where they did. OwlShack folds topicPrefix into the templates and deprecates it; here it simply stays the fallback, no config rewrite.
  • One resolveTopics now serves the packet topic, the status topic and the offline last-will, which connectBroker used to build separately.
  • Unknown placeholders and MQTT wildcards are refused when the config loads (startup error naming the broker; a SIGHUP reload keeps the running config).

Testing

  • Unit: default and topicPrefix topics unchanged, templates and uppercase tokens expand, bad templates refused naming the broker. Mutation-checked (validation made a no-op fails).
  • Binary against Mosquitto with packetTopic = "custom/{IATA}/{name}/pkt", statusTopic = "custom/{pubkey}/state", fed by a fake KISS modem: packet rows on custom/akl/Topic Obs/pkt, online on the custom status topic, and offline there both from a clean shutdown and from the broker's last-will after kill -9. No publish errors.
  • Full suite under -race.

Touches the same changelog list as #32; whichever merges second may need a rebase.

Ported from OwlShack: packetTopic and statusTopic take {iata} {pubkey}
{name} and meshcoretomqtt's uppercase tokens. Unset keeps the
topicPrefix layout, so existing configs publish where they did. One
resolver now serves the packet topic, the status topic and the offline
will, which used to build the status topic separately. Unknown
placeholders and wildcards are refused when the config loads.
@tuzzmaniandevil
tuzzmaniandevil force-pushed the feat/mqtt-topic-templates branch from e8bdf11 to ccc4fa9 Compare October 8, 2026 23:58
@tuzzmaniandevil
tuzzmaniandevil merged commit 5d343b9 into dev Oct 9, 2026
1 check passed
@tuzzmaniandevil
tuzzmaniandevil deleted the feat/mqtt-topic-templates branch October 9, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant