feat: add option to control repo mode
This commit is contained in:
parent
081e7d2f41
commit
2fb2e2e9f4
@ -1,5 +1,5 @@
|
||||
{{- $config := ds "config" }}
|
||||
{{- $defauls := data.YAML "{hostnames: [localhost], upstream_use_tls: false, proxy_ssl_protocols: TLSv1.2 TLSv1.3, proxy_hide_header: [X-Amz-*]}" -}}
|
||||
{{- $defauls := data.YAML "{hostnames: [localhost], repo_mode: false, upstream_use_tls: false, proxy_ssl_protocols: TLSv1.2 TLSv1.3, proxy_hide_header: [X-Amz-*]}" -}}
|
||||
|
||||
{{- range $config }}
|
||||
{{- $this := coll.Merge . $defauls }}
|
||||
@ -41,7 +41,7 @@ server {
|
||||
end
|
||||
return content
|
||||
}
|
||||
set $string_to_sign "GET\n\n\n${now}\n/{{ $this.bucket }}/${repo}$request_path";
|
||||
set $string_to_sign "GET\n\n\n${now}\n/{{ $this.bucket }}{{ if $this.repo_mode | conv.ToBool }}/${repo}{{ end }}$request_path";
|
||||
set_hmac_sha1 $aws_signature "$secret_access_key" "$string_to_sign";
|
||||
set_encode_base64 $aws_signature "$aws_signature";
|
||||
|
||||
@ -51,14 +51,14 @@ server {
|
||||
{{ end -}}
|
||||
|
||||
{{- if $this.upstream_use_tls }}
|
||||
proxy_pass https://backend_s3_{{ $this.bucket }}/{{ $this.bucket }}/${repo}$uri;
|
||||
proxy_pass https://backend_s3_{{ $this.bucket }}/{{ $this.bucket }}{{ if $this.repo_mode | conv.ToBool }}/${repo}{{ end }}$uri;
|
||||
proxy_ssl_name {{ $upstream_host }};
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
|
||||
proxy_ssl_protocols {{ $this.proxy_ssl_protocols }};
|
||||
{{- else }}
|
||||
proxy_pass http://backend_s3_{{ $this.bucket }}/{{ $this.bucket }}/${repo}$uri;
|
||||
proxy_pass http://backend_s3_{{ $this.bucket }}/{{ $this.bucket }}{{ if $this.repo_mode | conv.ToBool }}/${repo}{{ end }}$uri;
|
||||
{{- end }}
|
||||
|
||||
proxy_http_version 1.1;
|
||||
|
Loading…
Reference in New Issue
Block a user