From 2fb2e2e9f434098347112e45731074844d668d44 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 27 Sep 2023 00:02:20 +0200 Subject: [PATCH] feat: add option to control repo mode --- overlay/etc/templates/vhosts.conf.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overlay/etc/templates/vhosts.conf.tmpl b/overlay/etc/templates/vhosts.conf.tmpl index de3c7dd..34d8dd2 100644 --- a/overlay/etc/templates/vhosts.conf.tmpl +++ b/overlay/etc/templates/vhosts.conf.tmpl @@ -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;