Files
homeassistant-addons/octoprint-proxy/run.sh
Nikola 5fff8569b6 0nikola1 patch octoprint proxy (#89)
* Update and rename config.json to config.yaml

* Update run.sh

* FIxed addon startup issue
2022-12-16 10:42:04 +01:00

31 lines
990 B
Bash

#!/usr/bin/with-contenv 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