mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 09:48:14 +00:00
refactor: remove duplicate code
This commit is contained in:
parent
fe52878940
commit
dce7663b69
19
nginx.tmpl
19
nginx.tmpl
@ -350,8 +350,8 @@ upstream {{ $vpath.upstream }} {
|
|||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- /* debug "endpoint" response template */}}
|
{{- /* debug "endpoint" location template */}}
|
||||||
{{- define "debug_response" }}
|
{{- define "debug_location" }}
|
||||||
{{- $debug_paths := dict }}
|
{{- $debug_paths := dict }}
|
||||||
{{- range $path, $vpath := .VHost.paths }}
|
{{- range $path, $vpath := .VHost.paths }}
|
||||||
{{- $tmp_port := dict }}
|
{{- $tmp_port := dict }}
|
||||||
@ -383,7 +383,10 @@ upstream {{ $vpath.upstream }} {
|
|||||||
"vhost" $debug_vhost
|
"vhost" $debug_vhost
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{- toJson $debug_response }}
|
location /nginx-proxy-debug {
|
||||||
|
default_type application/json;
|
||||||
|
return 200 '{{ toJson $debug_response }}';
|
||||||
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- define "access_log" }}
|
{{- define "access_log" }}
|
||||||
@ -826,10 +829,7 @@ server {
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $vhost.enable_debug_endpoint }}
|
{{- if $vhost.enable_debug_endpoint }}
|
||||||
location /nginx-proxy-debug {
|
{{ template "debug_location" (dict "GlobalConfig" $globals.config "Hostname" $hostname "VHost" $vhost) }}
|
||||||
default_type application/json;
|
|
||||||
return 200 '{{- template "debug_response" (dict "GlobalConfig" $globals.config "Hostname" $hostname "VHost" $vhost) }}';
|
|
||||||
}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@ -949,10 +949,7 @@ server {
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $vhost.enable_debug_endpoint }}
|
{{- if $vhost.enable_debug_endpoint }}
|
||||||
location /nginx-proxy-debug {
|
{{ template "debug_location" (dict "GlobalConfig" $globals.config "Hostname" $hostname "VHost" $vhost) }}
|
||||||
default_type application/json;
|
|
||||||
return 200 '{{- template "debug_response" (dict "GlobalConfig" $globals.config "Hostname" $hostname "VHost" $vhost) }}';
|
|
||||||
}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- range $path, $vpath := $vhost.paths }}
|
{{- range $path, $vpath := $vhost.paths }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user