Add option to set camera url

This commit is contained in:
Fredrik Baberg 2024-01-21 15:55:38 +01:00
parent 7c95db9ba2
commit ce7cc735db
3 changed files with 9 additions and 2 deletions

View File

@ -26,11 +26,11 @@ usb: true
uart: true
options:
trusted_proxies: ""
# camera_url: "http://b7aa59c4-camera-mjpg-streamer"
camera_url: ""
# mode: normal
schema:
trusted_proxies: "str?"
# camera_url: "url?"
camera_url: "url?"
# mode: "list(normal|recovery|reverse_proxy_test|camera)?"
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
# codenotary:

View File

@ -9,6 +9,7 @@ bashio::var.json \
addon_hostname "$(bashio::addon.hostname)" \
addon_ip "$(bashio::addon.ip_address)" \
trusted_proxies "$(bashio::config 'trusted_proxies')" \
camera_url "$(bashio::config 'camera_url')" \
| tempio \
-template /usr/share/tempio/caddy/Caddyfile.internal_external.gtpl \
-out /etc/caddy/sites-enabled/internal_external.caddy

View File

@ -2,6 +2,12 @@
# * Home-Assistant OctoPrint integration.
# * Accessing OctoPrint WebUI through external port.
:5000 {
{{ if .camera_url }}
handle_path /camera/* {
rewrite * /{path}
reverse_proxy {{ .camera_url }}
}
{{ end }}
reverse_proxy http://127.0.0.1:80 {
trusted_proxies {{ .trusted_proxies }}
}