mirror of
https://github.com/valitydev/registrator.git
synced 2024-11-06 02:45:17 +00:00
Allow disabling IPv4 address registrations
This commit is contained in:
parent
d6f6d9e8e6
commit
79b3d1f19f
@ -251,14 +251,16 @@ func (b *Bridge) add(containerId string, quiet bool) {
|
||||
func (b *Bridge) newServices(port ServicePort, isgroup, quiet bool) []Service {
|
||||
services := make([]Service, 0)
|
||||
|
||||
svc := b.newService(port, isgroup, quiet, false)
|
||||
if b.config.IPv4 {
|
||||
svc := b.newService(port, isgroup, quiet, false)
|
||||
|
||||
if svc != nil {
|
||||
services = append(services, *svc)
|
||||
if svc != nil {
|
||||
services = append(services, *svc)
|
||||
}
|
||||
}
|
||||
|
||||
if b.config.IPv6 && port.container.NetworkSettings.GlobalIPv6Address != "" {
|
||||
svc = b.newService(port, isgroup, quiet, true)
|
||||
svc := b.newService(port, isgroup, quiet, true)
|
||||
|
||||
if svc != nil {
|
||||
services = append(services, *svc)
|
||||
|
@ -23,6 +23,7 @@ type Config struct {
|
||||
HostIp string
|
||||
Internal bool
|
||||
UseIpFromLabel string
|
||||
IPv4 bool
|
||||
IPv6 bool
|
||||
ForceTags string
|
||||
RefreshTtl int
|
||||
|
@ -22,6 +22,7 @@ var hostIp = flag.String("ip", "", "IP for ports mapped to the host")
|
||||
var internal = flag.Bool("internal", false, "Use internal ports instead of published ones")
|
||||
var useIpFromLabel = flag.String("useIpFromLabel", "", "Use IP which is stored in a label assigned to the container")
|
||||
var ipv6 = flag.Bool("ipv6", false, "Register services with container IPv6 addresses, if available")
|
||||
var ipv4 = flag.Bool("ipv4", true, "Register services with IPv4 addresses")
|
||||
var refreshInterval = flag.Int("ttl-refresh", 0, "Frequency with which service TTLs are refreshed")
|
||||
var refreshTtl = flag.Int("ttl", 0, "TTL for services (default is no expiry)")
|
||||
var forceTags = flag.String("tags", "", "Append tags for all registered services")
|
||||
@ -101,6 +102,7 @@ func main() {
|
||||
HostIp: *hostIp,
|
||||
Internal: *internal,
|
||||
UseIpFromLabel: *useIpFromLabel,
|
||||
IPv4: *ipv4,
|
||||
IPv6: *ipv6,
|
||||
ForceTags: *forceTags,
|
||||
RefreshTtl: *refreshTtl,
|
||||
|
Loading…
Reference in New Issue
Block a user