diff --git a/internal/configuration/setup/Setup.go b/internal/configuration/setup/Setup.go index 7767cd23..3586b509 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() @@ -874,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. ") @@ -907,3 +910,4 @@ func handleAwsError(w http.ResponseWriter, err error, prefix string) { _, _ = w.Write([]byte(prefix + "Error: " + err.Error())) } } + 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 }}