Skip to content

Commit 031057f

Browse files
committed
Fixes
1 parent 5c4385b commit 031057f

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

cmd/sync/aws.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,16 @@ func validateAWSConfig(cfg *awsConfig) error {
204204
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
205205
}
206206
if ups.MaxConns < 0 {
207-
return fmt.Errorf(upstreamMaxConnsErrorMsg, ups.MaxConns)
207+
return fmt.Errorf(upstreamMaxConnsErrorMsgFmt, ups.MaxConns)
208208
}
209209
if ups.MaxFails < 0 {
210-
return fmt.Errorf(upstreamMaxFailsErrorMsg, ups.MaxFails)
210+
return fmt.Errorf(upstreamMaxFailsErrorMsgFmt, ups.MaxFails)
211211
}
212212
if !isValidTime(ups.FailTimeout) {
213-
return fmt.Errorf(upstreamFailTimeoutErrorMsg, ups.FailTimeout)
213+
return fmt.Errorf(upstreamFailTimeoutErrorMsgFmt, ups.FailTimeout)
214214
}
215215
if !isValidTime(ups.SlowStart) {
216-
return fmt.Errorf(upstreamSlowStartErrorMsg, ups.SlowStart)
216+
return fmt.Errorf(upstreamSlowStartErrorMsgFmt, ups.SlowStart)
217217
}
218218
}
219219

cmd/sync/azure.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ func validateAzureConfig(cfg *azureConfig) error {
190190
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
191191
}
192192
if ups.MaxConns < 0 {
193-
return fmt.Errorf(upstreamMaxConnsErrorMsg, ups.MaxConns)
193+
return fmt.Errorf(upstreamMaxConnsErrorMsgFmt, ups.MaxConns)
194194
}
195195
if ups.MaxFails < 0 {
196-
return fmt.Errorf(upstreamMaxFailsErrorMsg, ups.MaxFails)
196+
return fmt.Errorf(upstreamMaxFailsErrorMsgFmt, ups.MaxFails)
197197
}
198198
if !isValidTime(ups.FailTimeout) {
199-
return fmt.Errorf(upstreamFailTimeoutErrorMsg, ups.FailTimeout)
199+
return fmt.Errorf(upstreamFailTimeoutErrorMsgFmt, ups.FailTimeout)
200200
}
201201
if !isValidTime(ups.SlowStart) {
202-
return fmt.Errorf(upstreamSlowStartErrorMsg, ups.SlowStart)
202+
return fmt.Errorf(upstreamSlowStartErrorMsgFmt, ups.SlowStart)
203203
}
204204
}
205205
return nil

cmd/sync/errormessages.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const upstreamNameErrorMsg = "The mandatory field name is either empty or missin
88
const upstreamErrorMsgFormat = "The mandatory field %v is either empty or missing for the upstream %v in the config file"
99
const upstreamPortErrorMsgFormat = "The mandatory field port is either zero or missing for the upstream %v in the config file"
1010
const upstreamKindErrorMsgFormat = "The mandatory field kind is either not equal to http or tcp or missing for the upstream %v in the config file"
11-
const upstreamMaxConnsErrorMsg = "The field max_conns has invalid value %v in the config file"
12-
const upstreamMaxFailsErrorMsg = "The field max_fails has invalid value %v in the config file"
13-
const upstreamFailTimeoutErrorMsg = "The field fail_timeout has invalid value %v in the config file"
14-
const upstreamSlowStartErrorMsg = "The field slow_start has invalid value %v in the config file"
11+
const upstreamMaxConnsErrorMsgFmt = "The field max_conns has invalid value %v in the config file"
12+
const upstreamMaxFailsErrorMsgFmt = "The field max_fails has invalid value %v in the config file"
13+
const upstreamFailTimeoutErrorMsgFmt = "The field fail_timeout has invalid value %v in the config file"
14+
const upstreamSlowStartErrorMsgFmt = "The field slow_start has invalid value %v in the config file"

cmd/sync/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func main() {
128128
}
129129

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

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

examples/aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ upstreams:
4646
* `port` – The port on which our backend applications are exposed.
4747
* `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.
4848
* `max_conns` – The maximum number of simultaneous active connections to an upstream server. Default value is 0, meaning there is no limit.
49-
* `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.
49+
* `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.
5050
* `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.
5151
* `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.

examples/azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ upstreams:
4747
* `port` – The port on which our backend applications are exposed.
4848
* `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.
4949
* `max_conns` – The maximum number of simultaneous active connections to an upstream server. Default value is 0, meaning there is no limit.
50-
* `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.
50+
* `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.
5151
* `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.
5252
* `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 commit comments

Comments
 (0)