This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new db8106e45 feat: support external grafana by EnvVar (#5010)
db8106e45 is described below
commit db8106e45ca97d896a5436a28ea0e92a2cd029a0
Author: Klesh Wong <[email protected]>
AuthorDate: Sun Apr 23 17:56:15 2023 +0800
feat: support external grafana by EnvVar (#5010)
---
config-ui/nginx.conf | 5 +++++
config-ui/nginx.sh | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/config-ui/nginx.conf b/config-ui/nginx.conf
index 098206310..adf7c8b2f 100644
--- a/config-ui/nginx.conf
+++ b/config-ui/nginx.conf
@@ -20,11 +20,16 @@ ${SERVER_CONF}
}
location /grafana/ {
+ set $external "${USE_EXTERNAL_GRAFANA}";
+ if ($external = "true") {
+ return 302 "${GRAFANA_ENDPOINT}";
+ }
resolver ${DNS} valid=${DNS_VALID};
resolver_timeout 3s;
set $target "${GRAFANA_ENDPOINT}";
rewrite /grafana/(.*) /$1 break;
proxy_set_header Authorization "";
+ proxy_set_header X-Forwarded-Access-Token "${cookie_access_token}";
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_pass ${GRAFANA_ENDPOINT_PROTO}://$target;
diff --git a/config-ui/nginx.sh b/config-ui/nginx.sh
old mode 100644
new mode 100755
index 1810accfd..7daa47577
--- a/config-ui/nginx.sh
+++ b/config-ui/nginx.sh
@@ -28,7 +28,7 @@ export DNS=$(grep nameserver /etc/resolv.conf | awk '{print
$2}')
export DNS_VALID=${DNS_VALID:-300s}
export DEVLAKE_ENDPOINT_PROTO=${DEVLAKE_ENDPOINT_PROTO:-http}
export GRAFANA_ENDPOINT_PROTO=${GRAFANA_ENDPOINT_PROTO:-http}
-envsubst '${DEVLAKE_ENDPOINT} ${DEVLAKE_ENDPOINT_PROTO} ${GRAFANA_ENDPOINT}
${GRAFANA_ENDPOINT_PROTO} ${SERVER_CONF} ${DNS} ${DNS_VALID}' \
+envsubst '${DEVLAKE_ENDPOINT} ${DEVLAKE_ENDPOINT_PROTO} ${GRAFANA_ENDPOINT}
${GRAFANA_ENDPOINT_PROTO} ${USE_EXTERNAL_GRAFANA} ${SERVER_CONF} ${DNS}
${DNS_VALID}' \
< /etc/nginx/conf.d/default.conf.tpl \
> /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'