diff options
| author | chrislu <chris.lu@gmail.com> | 2021-12-17 11:34:37 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2021-12-17 11:34:37 -0800 |
| commit | 85c526c583f6e1eb0a9499ba58fd9250ef25722d (patch) | |
| tree | d041ac71924c046a4130b66dc9f79d1e033ae4e4 /weed/command/s3.go | |
| parent | e526a299dc09373736cc64a09c4f6bf20408ced3 (diff) | |
| download | seaweedfs-85c526c583f6e1eb0a9499ba58fd9250ef25722d.tar.xz seaweedfs-85c526c583f6e1eb0a9499ba58fd9250ef25722d.zip | |
s3: bind to a specific IP
fix https://github.com/chrislusf/seaweedfs/issues/2516
Diffstat (limited to 'weed/command/s3.go')
| -rw-r--r-- | weed/command/s3.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/command/s3.go b/weed/command/s3.go index 1a4c89dc4..d7cd7818d 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -25,6 +25,7 @@ var ( type S3Options struct { filer *string + bindIp *string port *int config *string domainName *string @@ -38,6 +39,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.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") @@ -189,7 +191,7 @@ func (s3opt *S3Options) startS3Server() bool { httpS := &http.Server{Handler: router} - listenAddress := fmt.Sprintf(":%d", *s3opt.port) + listenAddress := fmt.Sprintf("%s:%d", *s3opt.bindIp, *s3opt.port) s3ApiListener, err := util.NewListener(listenAddress, time.Duration(10)*time.Second) if err != nil { glog.Fatalf("S3 API Server listener on %s error: %v", listenAddress, err) |
