mirror of https://github.com/status-im/consul.git
fix: gracefully fail on invalid port number (#16721)
This commit is contained in:
parent
769d9505a8
commit
7f6f6891f7
|
@ -455,6 +455,14 @@ func (b *builder) build() (rt RuntimeConfig, err error) {
|
||||||
sidecarMaxPort := b.portVal("ports.sidecar_max_port", c.Ports.SidecarMaxPort)
|
sidecarMaxPort := b.portVal("ports.sidecar_max_port", c.Ports.SidecarMaxPort)
|
||||||
exposeMinPort := b.portVal("ports.expose_min_port", c.Ports.ExposeMinPort)
|
exposeMinPort := b.portVal("ports.expose_min_port", c.Ports.ExposeMinPort)
|
||||||
exposeMaxPort := b.portVal("ports.expose_max_port", c.Ports.ExposeMaxPort)
|
exposeMaxPort := b.portVal("ports.expose_max_port", c.Ports.ExposeMaxPort)
|
||||||
|
if serverPort <= 0 {
|
||||||
|
return RuntimeConfig{}, fmt.Errorf(
|
||||||
|
"server-port must be greater than zero")
|
||||||
|
}
|
||||||
|
if serfPortLAN <= 0 {
|
||||||
|
return RuntimeConfig{}, fmt.Errorf(
|
||||||
|
"serf-lan-port must be greater than zero")
|
||||||
|
}
|
||||||
if proxyMaxPort < proxyMinPort {
|
if proxyMaxPort < proxyMinPort {
|
||||||
return RuntimeConfig{}, fmt.Errorf(
|
return RuntimeConfig{}, fmt.Errorf(
|
||||||
"proxy_min_port must be less than proxy_max_port. To disable, set both to zero.")
|
"proxy_min_port must be less than proxy_max_port. To disable, set both to zero.")
|
||||||
|
|
Loading…
Reference in New Issue