Skip to content

Make MQTT and Grafana dashboard settings configurable via environment variables - #2

Merged
NanoMil merged 9 commits into
munichmakerlab:mainfrom
Friedjof:feat/env-var-config
Sep 3, 2026
Merged

Make MQTT and Grafana dashboard settings configurable via environment variables#2
NanoMil merged 9 commits into
munichmakerlab:mainfrom
Friedjof:feat/env-var-config

Conversation

@Friedjof

@Friedjof Friedjof commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add small typed helpers (_env_str, _env_int, _env_bool) to read configuration from environment variables with a fallback default.
  • Make the MQTT broker connection (MQTT_BROKER_URL, MQTT_BROKER_PORT, MQTT_USERNAME, MQTT_PASSWORD, MQTT_KEEPALIVE, MQTT_TLS_ENABLED, MQTT_TOPIC) configurable via env vars.
  • Make the Grafana dashboard/panel used for the opening-times heatmap (GRAFANA_DASHBOARD_UID, GRAFANA_PANEL_ID) and its background refresh interval (HEATMAP_REFRESH_INTERVAL) configurable via env vars.
  • All variables keep the current MunichMakerLab values as defaults, so an unconfigured deployment behaves exactly as before.

Why

So the image can be reused for a different space/broker/dashboard (or just to override values for local testing) purely via docker run -e ... / compose.yml's environment:, without touching the source.

Test plan

  • Imported the app with no env vars set — all config falls back to the previous hardcoded defaults.
  • Overrode GRAFANA_PANEL_ID and HEATMAP_REFRESH_INTERVAL via env vars — values are picked up with correct types (int).
  • Overrode MQTT_BROKER_URL / MQTT_TLS_ENABLED — confirmed the MQTT client actually used the overridden host/TLS setting when connecting.

Friedjof and others added 9 commits September 3, 2026 22:21
…arning

v5 was pinned to a Node 20 runtime, which GitHub Actions now warns is
deprecated; v10 targets Node 24 natively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
astral-sh/setup-uv only publishes full semver tags, not a floating v10.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Build validation without publishing (build-test.yml) is now redundant
since a main push builds and publishes directly; folded into
docker-build-push.yml. Tag pushes still publish latest + semver tags,
gated separately so main pushes never touch `latest`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Friedjof
Friedjof force-pushed the feat/env-var-config branch from aec7b6c to f9c54fc Compare September 3, 2026 20:56
@NanoMil
NanoMil merged commit a2516e5 into munichmakerlab:main Sep 3, 2026
1 check passed
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.

2 participants