Add OctoPrint Reverse Proxy

This commit is contained in:
Max Winterstein
2021-01-04 00:14:55 +01:00
parent 001d41b342
commit 48fc1f2d78
9 changed files with 148 additions and 2 deletions

30
octoprint-proxy/run.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bashio
set -e
bashio::log.info "Setting octoprint host: $(bashio::config octoprint_host)"
sed -i "s/OCTOPRINT_HOST/$(bashio::config octoprint_host)/g" /haproxy.cfg
bashio::log.info "Setting octoprint port: $(bashio::config octoprint_port)"
sed -i "s/OCTOPRINT_PORT/$(bashio::config octoprint_port)/g" /haproxy.cfg
if $(bashio::config.true ssl.enabled); then
bashio::log.info "SSL communitcation to octoprint enabled"
sed -i "s/USE_SSL/ssl/g" /haproxy.cfg
if $(bashio::config.true ssl.verify); then
bashio::log.info "SSL verification enabled"
sed -i "s/VERIFY_SSL//g" /haproxy.cfg
else
bashio::log.info "SSL verification disabled"
sed -i "s/VERIFY_SSL/verify none/g" /haproxy.cfg
fi
else
bashio::log.info "SSL communitcation to octoprint not enabled"
sed -i "s/USE_SSL VERIFY_SSL//g" /haproxy.cfg
fi
bashio::log.info "Server line: $(cat /haproxy.cfg | grep 'server octoprint')"
bashio::log.info "Starting haproxy"
haproxy -W -db -f /haproxy.cfg