aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_s3_configure.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-07-13 02:30:53 -0700
committerchrislu <chris.lu@gmail.com>2022-07-13 02:30:53 -0700
commit9c0459685e4784d18c30105861e479af3aadb84f (patch)
tree5a467b9a57223f8d6e35922b1f84d065747915e2 /weed/shell/command_s3_configure.go
parent9a712df6eea5d24cba6fb068c913c3f2f771f4c3 (diff)
parent289402a741be0ee7370ae1d27834afb23003596d (diff)
downloadseaweedfs-9c0459685e4784d18c30105861e479af3aadb84f.tar.xz
seaweedfs-9c0459685e4784d18c30105861e479af3aadb84f.zip
Merge branch 'master' into messaging
Diffstat (limited to 'weed/shell/command_s3_configure.go')
-rw-r--r--weed/shell/command_s3_configure.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.go
index ddcafd847..0660b7889 100644
--- a/weed/shell/command_s3_configure.go
+++ b/weed/shell/command_s3_configure.go
@@ -2,6 +2,7 @@ package shell
import (
"bytes"
+ "errors"
"flag"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer"
@@ -164,6 +165,17 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
s3cfg.Identities = append(s3cfg.Identities, &identity)
}
+ accessKeySet := make(map[string]string)
+ for _, ident := range s3cfg.Identities {
+ for _, cred := range ident.Credentials {
+ if userName, found := accessKeySet[cred.AccessKey]; !found {
+ accessKeySet[cred.AccessKey] = ident.Name
+ } else {
+ return errors.New(fmt.Sprintf("duplicate accessKey[%s], already configured in user[%s]", cred.AccessKey, userName))
+ }
+ }
+ }
+
buf.Reset()
filer.ProtoToText(&buf, s3cfg)