Add config for camera

This commit is contained in:
Fredrik Baberg 2022-07-11 23:36:01 +02:00
parent 1012a52afa
commit 67f7dcf9fb
3 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint"
version: "2022.7.020"
version: "2022.7.021"
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"
@ -24,8 +24,10 @@ ports:
ports_description:
5000/tcp: Web-based interface (Not required for Ingress)
options:
camera_url: "http://b7aa59c4-camera-mjpg-streamer/"
recovery: false
schema:
camera_url: "url"
recovery: "bool"
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
tmpfs: true

View File

@ -9,6 +9,7 @@ bashio::var.json \
interface "$(bashio::addon.ip_address)" \
port "^$(bashio::addon.ingress_port)" \
ingress_entry "$(bashio::addon.ingress_entry)" \
camera_host "$(bashio::config 'camera_url')" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf

View File

@ -11,7 +11,7 @@ server {
proxy_set_header X-Forwarded-For 172.30.32.2;
proxy_set_header Origin 172.30.32.2;
proxy_pass http://127.0.0.1:5000/; # make sure to add trailing slash here!
proxy_pass http://octoprint/; # make sure to add trailing slash here!
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
@ -23,4 +23,16 @@ server {
client_max_body_size 0;
}
location /webcam/ {
proxy_pass {{ .camera_host }};
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_http_version 1.1;
client_max_body_size 0;
}
}