mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Add support for hostname lookups instead of IPs in MINIO_PUBLIC_IPS (#7018)
DNS names will be resolved to their respective IPs if specified in MINIO_PUBLIC_IPS. Fixes #6862
This commit is contained in:
parent
a536cf5dc0
commit
fb8d0d7cf7
@ -245,12 +245,22 @@ func handleCommonEnvVars() {
|
|||||||
minioEndpointsEnv, ok := os.LookupEnv("MINIO_PUBLIC_IPS")
|
minioEndpointsEnv, ok := os.LookupEnv("MINIO_PUBLIC_IPS")
|
||||||
if ok {
|
if ok {
|
||||||
minioEndpoints := strings.Split(minioEndpointsEnv, ",")
|
minioEndpoints := strings.Split(minioEndpointsEnv, ",")
|
||||||
for i, ip := range minioEndpoints {
|
var domainIPs = set.NewStringSet()
|
||||||
if net.ParseIP(ip) == nil {
|
for _, endpoint := range minioEndpoints {
|
||||||
logger.FatalIf(errInvalidArgument, "Unable to initialize Minio server with invalid MINIO_PUBLIC_IPS[%d]: %s", i, ip)
|
if net.ParseIP(endpoint) == nil {
|
||||||
|
// Checking if the IP is a DNS entry.
|
||||||
|
addrs, err := net.LookupHost(endpoint)
|
||||||
|
if err != nil {
|
||||||
|
logger.FatalIf(err, "Unable to initialize Minio server with [%s] invalid entry found in MINIO_PUBLIC_IPS", endpoint)
|
||||||
|
}
|
||||||
|
for _, addr := range addrs {
|
||||||
|
domainIPs.Add(addr)
|
||||||
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
domainIPs.Add(endpoint)
|
||||||
}
|
}
|
||||||
updateDomainIPs(set.CreateStringSet(minioEndpoints...))
|
updateDomainIPs(domainIPs)
|
||||||
} else {
|
} else {
|
||||||
// Add found interfaces IP address to global domain IPS,
|
// Add found interfaces IP address to global domain IPS,
|
||||||
// loopback addresses will be naturally dropped.
|
// loopback addresses will be naturally dropped.
|
||||||
|
Loading…
Reference in New Issue
Block a user