mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
bootup-validation: Allow port configuration only using --address option. (#3166)
This commit is contained in:
committed by
Harshavardhana
parent
d192044915
commit
8408dfaa6c
@@ -118,8 +118,31 @@ func parseStorageEndpoints(eps []string) (endpoints []*url.URL, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if u.Host != "" && globalMinioHost == "" {
|
||||
u.Host = net.JoinHostPort(u.Host, globalMinioPort)
|
||||
if u.Host != "" {
|
||||
_, port, err := net.SplitHostPort(u.Host)
|
||||
// Ignore the missing port error as the default port can be globalMinioPort.
|
||||
if err != nil && !strings.Contains(err.Error(), "missing port in address") {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if globalMinioHost == "" {
|
||||
// For ex.: minio server host1:port1 host2:port2...
|
||||
// we return error as port is configurable only
|
||||
// using "--address :port"
|
||||
if port != "" {
|
||||
errorIf(fmt.Errorf("Invalid argument %s, port configurable using --address :<port>", u.Host), "")
|
||||
return nil, errInvalidArgument
|
||||
}
|
||||
u.Host = net.JoinHostPort(u.Host, globalMinioPort)
|
||||
} else {
|
||||
// For ex.: minio server --address host:port host1:port1 host2:port2...
|
||||
// i.e if "--address host:port" is specified
|
||||
// port info in u.Host is mandatory else return error.
|
||||
if port == "" {
|
||||
errorIf(fmt.Errorf("Invalid argument %s, port mandatory when --address <host>:<port> is used", u.Host), "")
|
||||
return nil, errInvalidArgument
|
||||
}
|
||||
}
|
||||
}
|
||||
endpoints = append(endpoints, u)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user