File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -199,14 +199,16 @@ func (c *Controller) GetClient(ctx context.Context, etcdS3 *config.EtcdS3) (*Cli
199
199
tr .Proxy = http .ProxyURL (u )
200
200
}
201
201
202
- var creds * credentials.Credentials
203
- if len (etcdS3 .AccessKey ) == 0 && len (etcdS3 .SecretKey ) == 0 {
204
- creds = credentials .NewIAM ("" ) // for running on ec2 instance
205
- if _ , err := creds .Get (); err != nil {
206
- return nil , errors .Wrap (err , "failed to get IAM credentials" )
207
- }
208
- } else {
209
- creds = credentials .NewStaticV4 (etcdS3 .AccessKey , etcdS3 .SecretKey , "" )
202
+ creds := credentials .NewChainCredentials ([]credentials.Provider {
203
+ credentials .NewStaticV4 (etcdS3 .AccessKey , etcdS3 .SecretKey , "" ),
204
+ credentials .NewFileAWSCredentials ("" , "" ),
205
+ credentials .NewIAM ("" ),
206
+ })
207
+
208
+ if cval , err := creds .Get (); err != nil {
209
+ return nil , errors .Wrap (err , "failed to get credentials" )
210
+ } else if cval .SignerType == credentials .SignatureAnonymous {
211
+ return nil , errors .New ("all credential providers failed; cannot use anonymous" )
210
212
}
211
213
212
214
opt := minio.Options {
You can’t perform that action at this time.
0 commit comments