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`.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user