Browse Source

fix: allow environment variable fallback when filer config is empty

Fixed regression where AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
environment variables were not being loaded as fallback credentials.

The issue was that configLoaded was set to true when filer call
succeeded, even if it returned an empty configuration. This blocked
the environment variable fallback logic.

Now only set configLoaded = true when we actually have loaded
identities, allowing env vars to work correctly in mini mode and
other scenarios where filer config is empty.
pull/7992/head
Chris Lu 2 days ago
parent
commit
48ded6b965
  1. 10
      weed/s3api/auth_credentials.go

10
weed/s3api/auth_credentials.go

@ -184,12 +184,12 @@ func NewIdentityAccessManagementWithStore(option *S3ApiServerOption, explicitSto
glog.V(3).Infof("no static config file specified... loading config from credential manager")
if err := iam.loadS3ApiConfigurationFromFiler(option); err != nil {
glog.Warningf("fail to load config: %v", err)
} else {
// Check if any identities were actually loaded from filer
iam.m.RLock()
configLoaded = len(iam.identities) > 0
iam.m.RUnlock()
}
// Only consider config loaded if we actually have identities
// Don't block environment variable fallback just because filer call succeeded
iam.m.RLock()
configLoaded = len(iam.identities) > 0
iam.m.RUnlock()
}
// Only use environment variables as fallback if no configuration was loaded

Loading…
Cancel
Save