aboutsummaryrefslogtreecommitdiff
path: root/weed/command/s3.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-03-11 14:02:39 -0800
committerchrislu <chris.lu@gmail.com>2022-03-11 14:02:39 -0800
commit3a6eb8ca5ff6a8f3fbe76933847c0b804c26ba2a (patch)
tree18447926c32f7a8a7673137cb4d9bdd2fdc87845 /weed/command/s3.go
parent728bf50a731c2a171e4ca969f474a5565160a53a (diff)
downloadseaweedfs-3a6eb8ca5ff6a8f3fbe76933847c0b804c26ba2a.tar.xz
seaweedfs-3a6eb8ca5ff6a8f3fbe76933847c0b804c26ba2a.zip
default bind to one ip address
fix https://github.com/chrislusf/seaweedfs/issues/1937
Diffstat (limited to 'weed/command/s3.go')
-rw-r--r--weed/command/s3.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/command/s3.go b/weed/command/s3.go
index 3ce48ccb8..08e0afa4c 100644
--- a/weed/command/s3.go
+++ b/weed/command/s3.go
@@ -40,7 +40,7 @@ type S3Options struct {
func init() {
cmdS3.Run = runS3 // break init cycle
s3StandaloneOptions.filer = cmdS3.Flag.String("filer", "localhost:8888", "filer server address")
- s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to")
+ s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to. Default to localhost.")
s3StandaloneOptions.port = cmdS3.Flag.Int("port", 8333, "s3 server http listen port")
s3StandaloneOptions.domainName = cmdS3.Flag.String("domainName", "", "suffix of the host name in comma separated list, {bucket}.{domainName}")
s3StandaloneOptions.config = cmdS3.Flag.String("config", "", "path to the config file")
@@ -193,6 +193,10 @@ func (s3opt *S3Options) startS3Server() bool {
httpS := &http.Server{Handler: router}
+ if *s3opt.bindIp == "" {
+ *s3opt.bindIp = "localhost"
+ }
+
listenAddress := fmt.Sprintf("%s:%d", *s3opt.bindIp, *s3opt.port)
s3ApiListener, err := util.NewListener(listenAddress, time.Duration(10)*time.Second)
if err != nil {