File tree 3 files changed +22
-20
lines changed 3 files changed +22
-20
lines changed Original file line number Diff line number Diff line change 1
1
package config
2
2
3
3
var serversTemplateText = `
4
- {{ range $s := . }}
5
- {{ if $s.IsDefaultSSL }}
4
+ {{ range $s := . - }}
5
+ {{ if $s.IsDefaultSSL - }}
6
6
server {
7
7
listen 443 ssl default_server;
8
8
9
9
ssl_reject_handshake on;
10
10
}
11
- {{ else if $s.IsDefaultHTTP }}
11
+ {{- else if $s.IsDefaultHTTP }}
12
12
server {
13
13
listen 80 default_server;
14
14
15
15
default_type text/html;
16
16
return 404;
17
17
}
18
- {{ else }}
18
+ {{- else }}
19
19
server {
20
- {{ if $s.SSL }}
20
+ {{- if $s.SSL }}
21
21
listen 443 ssl;
22
22
ssl_certificate {{ $s.SSL.Certificate }};
23
23
ssl_certificate_key {{ $s.SSL.CertificateKey }};
24
24
25
25
if ($ssl_server_name != $host) {
26
26
return 421;
27
27
}
28
- {{ end }}
28
+ {{- end }}
29
29
30
30
server_name {{ $s.ServerName }};
31
31
32
32
{{ range $l := $s.Locations }}
33
33
location {{ $l.Path }} {
34
- {{ if $l.Internal }}
34
+ {{ if $l.Internal - }}
35
35
internal;
36
36
{{ end }}
37
37
38
- {{ if $l.Return }}
38
+ {{- if $l.Return - }}
39
39
return {{ $l.Return.Code }} "{{ $l.Return.Body }}";
40
40
{{ end }}
41
41
42
- {{ if $l.HTTPMatchVar }}
42
+ {{- if $l.HTTPMatchVar - }}
43
43
set $http_matches {{ $l.HTTPMatchVar | printf "%q" }};
44
44
js_content httpmatches.redirect;
45
45
{{ end }}
46
46
47
- {{ if $l.ProxyPass }}
47
+ {{- if $l.ProxyPass - }}
48
48
proxy_set_header Host $host;
49
49
proxy_pass {{ $l.ProxyPass }}$request_uri;
50
- {{ end }}
50
+ {{- end }}
51
51
}
52
52
{{ end }}
53
53
}
54
- {{ end }}
54
+ {{- end }}
55
55
{{ end }}
56
56
server {
57
57
listen unix:/var/lib/nginx/nginx-502-server.sock;
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ package config
3
3
var splitClientsTemplateText = `
4
4
{{ range $sc := . }}
5
5
split_clients $request_id ${{ $sc.VariableName }} {
6
- {{ range $d := $sc.Distributions }}
7
- {{ if eq $d.Percent "0.00" }}
6
+ {{- range $d := $sc.Distributions }}
7
+ {{- if eq $d.Percent "0.00" }}
8
8
# {{ $d.Percent }}% {{ $d.Value }};
9
- {{ else }}
9
+ {{- else }}
10
10
{{ $d.Percent }}% {{ $d.Value }};
11
- {{ end }}
12
- {{ end }}
11
+ {{- end }}
12
+ {{- end }}
13
13
}
14
- {{ end }}`
14
+ {{ end }}
15
+ `
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ upstream {{ $u.Name }} {
8
8
random two least_conn;
9
9
{{ range $server := $u.Servers }}
10
10
server {{ $server.Address }};
11
- {{ end }}
11
+ {{- end }}
12
12
}
13
- {{ end }}`
13
+ {{ end }}
14
+ `
You can’t perform that action at this time.
0 commit comments