From f23f53e50dd077d2a1537c51332f227e08230ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 13:34:53 +0900 Subject: [PATCH 1/5] fix: load S3 env vars during initial setup --- internal/configuration/setup/Setup.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/configuration/setup/Setup.go b/internal/configuration/setup/Setup.go index 7767cd23..f3112d07 100644 --- a/internal/configuration/setup/Setup.go +++ b/internal/configuration/setup/Setup.go @@ -719,7 +719,10 @@ func (v *setupView) loadFromConfig() { v.HasAwsFeature = aws.IsIncludedInBuild v.ProtectedUrls = protectedUrls if isInitialSetup { - v.MinPasswordLength = environment.New().MinLengthPassword + env := environment.New() + v.MinPasswordLength = env.MinLengthPassword + v.CloudSettings, _ = cloudconfig.Load() + v.S3EnvProvided = env.IsAwsProvided() return } configuration.Load() From 668d5c3a0ecc3b6618e5f7b62be340448cad5c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 14:26:38 +0900 Subject: [PATCH 2/5] fix: auto-select Cloud Storage on initial setup when S3 env vars are set --- .../configuration/setup/templates/setup.tmpl | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/internal/configuration/setup/templates/setup.tmpl b/internal/configuration/setup/templates/setup.tmpl index 27d794e4..68196504 100644 --- a/internal/configuration/setup/templates/setup.tmpl +++ b/internal/configuration/setup/templates/setup.tmpl @@ -821,28 +821,27 @@ function TestAWS(button, isManual) { } - {{ if .CloudSettings.Aws.Bucket }} +{{ end }} + +{{ if .CloudSettings.Aws.Bucket }} document.getElementById("storage_sel").value = "cloud"; storageSelectionChanged(1); - - {{ if .CloudSettings.Aws.ProxyDownload }} + + {{ if .CloudSettings.Aws.ProxyDownload }} document.getElementById("storage_sel_proxy").value = "proxy"; - {{ end }} - - {{ if .Settings.PicturesAlwaysLocal }} + {{ end }} + + {{ if .Settings.PicturesAlwaysLocal }} document.getElementById("storage_sel_image").value = "local"; - {{ end }} - - {{ if not .S3EnvProvided }} + {{ end }} + + {{ if not .S3EnvProvided }} document.getElementById("s3_bucket").value = "{{ .CloudSettings.Aws.Bucket }}"; document.getElementById("s3_region").value = "{{ .CloudSettings.Aws.Region }}"; document.getElementById("s3_api").value = "{{ .CloudSettings.Aws.KeyId }}"; document.getElementById("s3_secret").value = "{{ .CloudSettings.Aws.KeySecret }}"; document.getElementById("s3_endpoint").value = "{{ .CloudSettings.Aws.Endpoint }}"; - {{ end }} {{ end }} - - {{ end }} From 7eab36331887c2a162d2130f134e0d8d2b232d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 17:40:09 +0900 Subject: [PATCH 3/5] style: preserve original indentation in setup template --- internal/configuration/setup/templates/setup.tmpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/configuration/setup/templates/setup.tmpl b/internal/configuration/setup/templates/setup.tmpl index 68196504..ecb2ae97 100644 --- a/internal/configuration/setup/templates/setup.tmpl +++ b/internal/configuration/setup/templates/setup.tmpl @@ -823,26 +823,26 @@ function TestAWS(button, isManual) { {{ end }} -{{ if .CloudSettings.Aws.Bucket }} + {{ if .CloudSettings.Aws.Bucket }} document.getElementById("storage_sel").value = "cloud"; storageSelectionChanged(1); - {{ if .CloudSettings.Aws.ProxyDownload }} + {{ if .CloudSettings.Aws.ProxyDownload }} document.getElementById("storage_sel_proxy").value = "proxy"; - {{ end }} + {{ end }} - {{ if .Settings.PicturesAlwaysLocal }} + {{ if .Settings.PicturesAlwaysLocal }} document.getElementById("storage_sel_image").value = "local"; - {{ end }} + {{ end }} - {{ if not .S3EnvProvided }} + {{ if not .S3EnvProvided }} document.getElementById("s3_bucket").value = "{{ .CloudSettings.Aws.Bucket }}"; document.getElementById("s3_region").value = "{{ .CloudSettings.Aws.Region }}"; document.getElementById("s3_api").value = "{{ .CloudSettings.Aws.KeyId }}"; document.getElementById("s3_secret").value = "{{ .CloudSettings.Aws.KeySecret }}"; document.getElementById("s3_endpoint").value = "{{ .CloudSettings.Aws.Endpoint }}"; + {{ end }} {{ end }} -{{ end }} wizard.on("submit", function(wizard) { From 52fffdac816d0e1284bcb81a4f4e8a454d7653e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 17:44:05 +0900 Subject: [PATCH 4/5] style: fix template directive indentation after block move --- internal/configuration/setup/templates/setup.tmpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/configuration/setup/templates/setup.tmpl b/internal/configuration/setup/templates/setup.tmpl index ecb2ae97..68196504 100644 --- a/internal/configuration/setup/templates/setup.tmpl +++ b/internal/configuration/setup/templates/setup.tmpl @@ -823,26 +823,26 @@ function TestAWS(button, isManual) { {{ end }} - {{ if .CloudSettings.Aws.Bucket }} +{{ if .CloudSettings.Aws.Bucket }} document.getElementById("storage_sel").value = "cloud"; storageSelectionChanged(1); - {{ if .CloudSettings.Aws.ProxyDownload }} + {{ if .CloudSettings.Aws.ProxyDownload }} document.getElementById("storage_sel_proxy").value = "proxy"; - {{ end }} + {{ end }} - {{ if .Settings.PicturesAlwaysLocal }} + {{ if .Settings.PicturesAlwaysLocal }} document.getElementById("storage_sel_image").value = "local"; - {{ end }} + {{ end }} - {{ if not .S3EnvProvided }} + {{ if not .S3EnvProvided }} document.getElementById("s3_bucket").value = "{{ .CloudSettings.Aws.Bucket }}"; document.getElementById("s3_region").value = "{{ .CloudSettings.Aws.Region }}"; document.getElementById("s3_api").value = "{{ .CloudSettings.Aws.KeyId }}"; document.getElementById("s3_secret").value = "{{ .CloudSettings.Aws.KeySecret }}"; document.getElementById("s3_endpoint").value = "{{ .CloudSettings.Aws.Endpoint }}"; - {{ end }} {{ end }} +{{ end }} wizard.on("submit", function(wizard) { From e511ba5ba5625e8f489e18582d74da48761f8720 Mon Sep 17 00:00:00 2001 From: Marc Ole Bulling Date: Sun, 1 Mar 2026 11:01:21 +0100 Subject: [PATCH 5/5] Fixed test button for ENV provided credentials --- internal/configuration/setup/Setup.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/configuration/setup/Setup.go b/internal/configuration/setup/Setup.go index f3112d07..3586b509 100644 --- a/internal/configuration/setup/Setup.go +++ b/internal/configuration/setup/Setup.go @@ -877,7 +877,7 @@ func handleTestAws(w http.ResponseWriter, r *http.Request) { return } aws.Init(awsConfig) - ok, err = aws.IsCorsCorrectlySet(t.Bucket, t.GokapiUrl) + ok, err = aws.IsCorsCorrectlySet(awsConfig.Bucket, t.GokapiUrl) aws.LogOut() if err != nil { handleAwsError(w, err, "Could not get CORS settings. ") @@ -910,3 +910,4 @@ func handleAwsError(w http.ResponseWriter, err error, prefix string) { _, _ = w.Write([]byte(prefix + "Error: " + err.Error())) } } +