From 451b897d56eed7865c48e150b5cd6dec17f42c9f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 8 Jan 2026 20:17:33 -0800 Subject: [PATCH] fix: support loading static config from IamConfig option for mini mode `weed mini` sets the `-s3.iam.config` flag instead of `-s3.config`, which populates `S3ApiServerOption.IamConfig`. Previously, `NewIdentityAccessManagementWithStore` only checked `option.Config`. This caused `weed mini` generated credentials (written to a temp file passed via IamConfig) to be ignored, breaking S3 access in mini mode even when environment variables were provided. This change ensures we try to load the configuration from `IamConfig` if `Config` is empty, restoring functionality for `weed mini`. --- weed/s3api/auth_credentials.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index 978b6c0e4..e6cd71adf 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -164,10 +164,16 @@ func NewIdentityAccessManagementWithStore(option *S3ApiServerOption, explicitSto configLoaded := false // First, try to load configurations from file or filer - if option.Config != "" { - glog.V(3).Infof("loading static config file %s", option.Config) - if err := iam.loadS3ApiConfigurationFromFile(option.Config); err != nil { - glog.Fatalf("fail to load config file %s: %v", option.Config, err) + // First, try to load configurations from file or filer + startConfigFile := option.Config + if startConfigFile == "" { + startConfigFile = option.IamConfig + } + + if startConfigFile != "" { + glog.V(3).Infof("loading static config file %s", startConfigFile) + if err := iam.loadS3ApiConfigurationFromFile(startConfigFile); err != nil { + glog.Fatalf("fail to load config file %s: %v", startConfigFile, err) } // Track identity names from static config to protect them from dynamic updates