Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Marrero committed Nov 14, 2019
1 parent 5c4385b commit 031057f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cmd/sync/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,16 @@ func validateAWSConfig(cfg *awsConfig) error {
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
}
if ups.MaxConns < 0 {
return fmt.Errorf(upstreamMaxConnsErrorMsg, ups.MaxConns)
return fmt.Errorf(upstreamMaxConnsErrorMsgFmt, ups.MaxConns)
}
if ups.MaxFails < 0 {
return fmt.Errorf(upstreamMaxFailsErrorMsg, ups.MaxFails)
return fmt.Errorf(upstreamMaxFailsErrorMsgFmt, ups.MaxFails)
}
if !isValidTime(ups.FailTimeout) {
return fmt.Errorf(upstreamFailTimeoutErrorMsg, ups.FailTimeout)
return fmt.Errorf(upstreamFailTimeoutErrorMsgFmt, ups.FailTimeout)
}
if !isValidTime(ups.SlowStart) {
return fmt.Errorf(upstreamSlowStartErrorMsg, ups.SlowStart)
return fmt.Errorf(upstreamSlowStartErrorMsgFmt, ups.SlowStart)
}
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/sync/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ func validateAzureConfig(cfg *azureConfig) error {
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
}
if ups.MaxConns < 0 {
return fmt.Errorf(upstreamMaxConnsErrorMsg, ups.MaxConns)
return fmt.Errorf(upstreamMaxConnsErrorMsgFmt, ups.MaxConns)
}
if ups.MaxFails < 0 {
return fmt.Errorf(upstreamMaxFailsErrorMsg, ups.MaxFails)
return fmt.Errorf(upstreamMaxFailsErrorMsgFmt, ups.MaxFails)
}
if !isValidTime(ups.FailTimeout) {
return fmt.Errorf(upstreamFailTimeoutErrorMsg, ups.FailTimeout)
return fmt.Errorf(upstreamFailTimeoutErrorMsgFmt, ups.FailTimeout)
}
if !isValidTime(ups.SlowStart) {
return fmt.Errorf(upstreamSlowStartErrorMsg, ups.SlowStart)
return fmt.Errorf(upstreamSlowStartErrorMsgFmt, ups.SlowStart)
}
}
return nil
Expand Down
8 changes: 4 additions & 4 deletions cmd/sync/errormessages.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const upstreamNameErrorMsg = "The mandatory field name is either empty or missin
const upstreamErrorMsgFormat = "The mandatory field %v is either empty or missing for the upstream %v in the config file"
const upstreamPortErrorMsgFormat = "The mandatory field port is either zero or missing for the upstream %v in the config file"
const upstreamKindErrorMsgFormat = "The mandatory field kind is either not equal to http or tcp or missing for the upstream %v in the config file"
const upstreamMaxConnsErrorMsg = "The field max_conns has invalid value %v in the config file"
const upstreamMaxFailsErrorMsg = "The field max_fails has invalid value %v in the config file"
const upstreamFailTimeoutErrorMsg = "The field fail_timeout has invalid value %v in the config file"
const upstreamSlowStartErrorMsg = "The field slow_start has invalid value %v in the config file"
const upstreamMaxConnsErrorMsgFmt = "The field max_conns has invalid value %v in the config file"
const upstreamMaxFailsErrorMsgFmt = "The field max_fails has invalid value %v in the config file"
const upstreamFailTimeoutErrorMsgFmt = "The field fail_timeout has invalid value %v in the config file"
const upstreamSlowStartErrorMsgFmt = "The field slow_start has invalid value %v in the config file"
4 changes: 2 additions & 2 deletions cmd/sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func main() {
}

if len(added) > 0 || len(removed) > 0 || len(updated) > 0 {
log.Printf("Updated HTTP servers of %v; Added: %v, Removed: %v, Updated: %v", upstream, added, removed, updated)
log.Printf("Updated HTTP servers of %v; Added: %+v, Removed: %+v, Updated: %+v", upstream, added, removed, updated)
}
} else {
var upsServers []nginx.StreamUpstreamServer
Expand All @@ -150,7 +150,7 @@ func main() {
}

if len(added) > 0 || len(removed) > 0 || len(updated) > 0 {
log.Printf("Updated Stream servers of %v; Added: %v, Removed: %v, Updated: %v", upstream, added, removed, updated)
log.Printf("Updated Stream servers of %v; Added: %+v, Removed: %+v, Updated: %+v", upstream, added, removed, updated)
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ upstreams:
* `port` – The port on which our backend applications are exposed.
* `kind` – The protocol of the traffic NGINX Plus load balances to the backend application, here `http`. If the application uses TCP/UDP, specify `stream` instead.
* `max_conns` – The maximum number of simultaneous active connections to an upstream server. Default value is 0, meaning there is no limit.
* `max_fails` – The number of unsuccessful attempts to communicate with an upstream server that should happen in the duration set by the `fail-timeout` to consider the server unavailable. Default value is 1. The zero value 0 disables the accounting of attempts.
* `max_fails` – The number of unsuccessful attempts to communicate with an upstream server that should happen in the duration set by the `fail-timeout` to consider the server unavailable. Default value is 1. The zero value disables the accounting of attempts.
* `fail_timeout` – The time during which the specified number of unsuccessful attempts to communicate with an upstream server should happen to consider the server unavailable. Default value is 10s.
* `slow_start` – The slow start allows an upstream server to gradually recover its weight from 0 to its nominal value after it has been recovered or became available or when the server becomes available after a period of time it was considered unavailable. By default, the slow start is disabled.
2 changes: 1 addition & 1 deletion examples/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ upstreams:
* `port` – The port on which our backend applications are exposed.
* `kind` – The protocol of the traffic NGINX Plus load balances to the backend application, here `http`. If the application uses TCP/UDP, specify `stream` instead.
* `max_conns` – The maximum number of simultaneous active connections to an upstream server. Default value is 0, meaning there is no limit.
* `max_fails` – The number of unsuccessful attempts to communicate with an upstream server that should happen in the duration set by the `fail-timeout` to consider the server unavailable. Default value is 1. The zero value 0 disables the accounting of attempts.
* `max_fails` – The number of unsuccessful attempts to communicate with an upstream server that should happen in the duration set by the `fail-timeout` to consider the server unavailable. Default value is 1. The zero value disables the accounting of attempts.
* `fail_timeout` – The time during which the specified number of unsuccessful attempts to communicate with an upstream server should happen to consider the server unavailable. Default value is 10s.
* `slow_start` – The slow start allows an upstream server to gradually recover its weight from 0 to its nominal value after it has been recovered or became available or when the server becomes available after a period of time it was considered unavailable. By default, the slow start is disabled.

0 comments on commit 031057f

Please sign in to comment.