From d2899a6abd421ccde3bbe944ecd0e63495fd659f Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 21 Jan 2025 17:28:42 -0600 Subject: [PATCH] announce if mapping is being set or applied. --- grafana.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grafana.sh b/grafana.sh index 8e18001..bab3763 100644 --- a/grafana.sh +++ b/grafana.sh @@ -179,6 +179,7 @@ while [ $secs -gt 0 ]; do done if [ -f "$WS_CONF" ]; then + echo "> Setting up webserver configuration file..." sed -i "/$WS_MATCH1/i \ \ \ \ # Proxy Grafana." "$WS_CONF" sed -i "/$WS_MATCH1/i \ \ \ \ location ~ ^/(grafana/|grafana/login) {" "$WS_CONF" sed -i "/$WS_MATCH1/i \ \ \ \ \ \ proxy_set_header Host \$host;" "$WS_CONF" @@ -193,15 +194,16 @@ if [ -f "$WS_CONF" ]; then sed -i "/$WS_MATCH1/i \ \ \ \ \ \ proxy_set_header Host \$host;" "$WS_CONF" sed -i "/$WS_MATCH1/i \ \ \ \ \ \ proxy_pass http://grafana;" "$WS_CONF" sed -i "/$WS_MATCH1/i \ \ \ \ }" "$WS_CONF" - if ! grep -q 'map $http_upgrade $connection_upgrade' "$WS_CONF"; then + echo " > Setting mapping upgrade connection." sed -i "/$WS_MATCH2/i # This is required to proxy Grafana Live WebSocket connections or Etherpad" "$WS_CONF" sed -i "/$WS_MATCH2/i map \$http_upgrade \$connection_upgrade {" "$WS_CONF" sed -i "/$WS_MATCH2/i \ \ default upgrade;" "$WS_CONF" sed -i "/$WS_MATCH2/i \ \ '' close;" "$WS_CONF" sed -i "/$WS_MATCH2/i }" "$WS_CONF" + else + echo " > Upgrade connection mapping already setup." fi - sed -i "/$WS_MATCH1/i \\\n" "$WS_CONF" sed -i "/$WS_MATCH2/i upstream grafana {" "$WS_CONF" sed -i "/$WS_MATCH2/i \ \ server localhost:3000;" "$WS_CONF"