Separate internal and external access, again.

This commit is contained in:
Fredrik Baberg 2023-01-11 16:11:41 +01:00
parent dcc46a98f2
commit 55a0d03a93
5 changed files with 35 additions and 29 deletions

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint"
version: "2023.01.01"
version: "2023.01.02"
slug: "3dprinter-octoprint"
description: "OctoPrint as an addon, no additional bells and whistles."
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
@ -23,13 +23,13 @@ ports:
5000/tcp: null
ports_description:
5000/tcp: Web-based interface
# options:
# camera_url: "http://b7aa59c4-camera-mjpg-streamer"
# mode: normal
# trusted_proxies: ""
# schema:
# camera_url: "url?"
# mode: "list(normal|recovery|reverse_proxy_test|camera)?"
# trusted_proxies: "str?"
options:
trusted_proxies: ""
# camera_url: "http://b7aa59c4-camera-mjpg-streamer"
# mode: normal
schema:
trusted_proxies: "str?"
# camera_url: "url?"
# mode: "list(normal|recovery|reverse_proxy_test|camera)?"
tmpfs: true
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}

View File

@ -1,5 +0,0 @@
# OctoPrint WebUI through any access (external or internal)
:5000 {
reverse_proxy http://127.0.0.1:80 {
}
}

View File

@ -4,6 +4,21 @@
# Configures proxy
# ==============================================================================
# Generate proxy configuration for internal access
bashio::var.json \
addon_hostname "$(bashio::addon.hostname)" \
addon_ip "$(bashio::addon.ip_address)" \
| tempio \
-template /usr/share/tempio/caddy/Caddyfile.internal.gtpl \
-out /etc/caddy/sites-enabled/internal.caddy
# Generate proxy configuration for external access
bashio::var.json \
trusted_proxies "$(bashio::config 'trusted_proxies')" \
| tempio \
-template /usr/share/tempio/caddy/Caddyfile.external.gtpl \
-out /etc/caddy/sites-enabled/external.caddy
# Generate proxy configuration for access by Ingress
# bashio::var.json \
# addon_hostname "$(bashio::addon.hostname)" \
@ -19,17 +34,6 @@
# -template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
# -out /etc/caddy/sites-enabled/ingress.caddy
# Generate proxy configuration for any access
# tempio \
# -template /usr/share/tempio/caddy/Caddyfile.any.gtpl \
# -out /etc/caddy/sites-enabled/any.caddy
# # Generate proxy configuration for internal access
# bashio::var.json \
# addon_hostname "$(bashio::addon.hostname)" \
# | tempio \
# -template /usr/share/tempio/caddy/Caddyfile.internal.gtpl \
# -out /etc/caddy/sites-enabled/internal.caddy
# Make sure file is correctly formatted.
# caddy fmt --overwrite /etc/caddy/Caddyfile
# Make sure config is correctly formatted.
caddy fmt --overwrite /etc/caddy/Caddyfile

View File

@ -0,0 +1,6 @@
# OctoPrint WebUI through external access
:5000 {
reverse_proxy http://127.0.0.1:80 {
trusted_proxies {{ .trusted_proxies }}
}
}

View File

@ -1,5 +1,6 @@
# WebUI through internal hostname
{{ .addon_hostname }}:5000 {
# Internal access, e.g. for Home-Assistant OctoPrint integration.
:5000 {
bind {{ .addon_ip }}
reverse_proxy http://127.0.0.1:80 {
}
}