add support for regex locations
This commit is contained in:
parent
fecd2713fe
commit
e684ad9a99
1 changed files with 8 additions and 2 deletions
10
nginx.tmpl
10
nginx.tmpl
|
@ -294,7 +294,10 @@ server {
|
||||||
{{ range $container := $containers }}
|
{{ range $container := $containers }}
|
||||||
{{/* Determine whether this container has specified a virtual path, or default to the / pattern */}}
|
{{/* Determine whether this container has specified a virtual path, or default to the / pattern */}}
|
||||||
{{ $location := coalesce $container.Env.VIRTUAL_PATH "/" }}
|
{{ $location := coalesce $container.Env.VIRTUAL_PATH "/" }}
|
||||||
location {{ $location }} {
|
{{ $is_regexp := hasPrefix "^" $location }}
|
||||||
|
{{ $modifier := when $is_regexp "~" "" }}
|
||||||
|
|
||||||
|
location {{ $modifier }} '{{ $location }}' {
|
||||||
{{ if eq $proto "uwsgi" }}
|
{{ if eq $proto "uwsgi" }}
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }};
|
uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }};
|
||||||
|
@ -346,7 +349,10 @@ server {
|
||||||
{{/* Determine whether this container has specified a virtual path, or default to the / pattern */}}
|
{{/* Determine whether this container has specified a virtual path, or default to the / pattern */}}
|
||||||
{{ $location := coalesce $container.Env.VIRTUAL_PATH "/" }}
|
{{ $location := coalesce $container.Env.VIRTUAL_PATH "/" }}
|
||||||
|
|
||||||
location {{ $location }} {
|
{{ $is_regexp := hasPrefix "^" $location }}
|
||||||
|
{{ $modifier := when $is_regexp "~" "" }}
|
||||||
|
|
||||||
|
location {{ $modifier }} '{{ $location }}' {
|
||||||
{{ if eq $proto "uwsgi" }}
|
{{ if eq $proto "uwsgi" }}
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }};
|
uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }};
|
||||||
|
|
Loading…
Reference in a new issue