@@ -58,20 +58,12 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
58
58
cfgParams .ProxySendTimeout = proxySendTimeout
59
59
}
60
60
61
- if proxyHideHeaders , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "proxy-hide-headers" , cfgm , "," ); exists {
62
- if err != nil {
63
- glog .Error (err )
64
- } else {
65
- cfgParams .ProxyHideHeaders = proxyHideHeaders
66
- }
61
+ if proxyHideHeaders , exists := GetMapKeyAsStringSlice (cfgm .Data , "proxy-hide-headers" , cfgm , "," ); exists {
62
+ cfgParams .ProxyHideHeaders = proxyHideHeaders
67
63
}
68
64
69
- if proxyPassHeaders , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "proxy-pass-headers" , cfgm , "," ); exists {
70
- if err != nil {
71
- glog .Error (err )
72
- } else {
73
- cfgParams .ProxyPassHeaders = proxyPassHeaders
74
- }
65
+ if proxyPassHeaders , exists := GetMapKeyAsStringSlice (cfgm .Data , "proxy-pass-headers" , cfgm , "," ); exists {
66
+ cfgParams .ProxyPassHeaders = proxyPassHeaders
75
67
}
76
68
77
69
if clientMaxBodySize , exists := cfgm .Data ["client-max-body-size" ]; exists {
@@ -170,12 +162,8 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
170
162
}
171
163
}
172
164
173
- if setRealIPFrom , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "set-real-ip-from" , cfgm , "," ); exists {
174
- if err != nil {
175
- glog .Error (err )
176
- } else {
177
- cfgParams .SetRealIPFrom = setRealIPFrom
178
- }
165
+ if setRealIPFrom , exists := GetMapKeyAsStringSlice (cfgm .Data , "set-real-ip-from" , cfgm , "," ); exists {
166
+ cfgParams .SetRealIPFrom = setRealIPFrom
179
167
}
180
168
181
169
if realIPRecursive , exists , err := GetMapKeyAsBool (cfgm .Data , "real-ip-recursive" , cfgm ); exists {
@@ -219,12 +207,8 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
219
207
}
220
208
}
221
209
222
- if logFormat , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "log-format" , cfgm , "\n " ); exists {
223
- if err != nil {
224
- glog .Error (err )
225
- } else {
226
- cfgParams .MainLogFormat = logFormat
227
- }
210
+ if logFormat , exists := GetMapKeyAsStringSlice (cfgm .Data , "log-format" , cfgm , "\n " ); exists {
211
+ cfgParams .MainLogFormat = logFormat
228
212
}
229
213
230
214
if logFormatEscaping , exists := cfgm .Data ["log-format-escaping" ]; exists {
@@ -234,12 +218,8 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
234
218
}
235
219
}
236
220
237
- if streamLogFormat , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "stream-log-format" , cfgm , "\n " ); exists {
238
- if err != nil {
239
- glog .Error (err )
240
- } else {
241
- cfgParams .MainStreamLogFormat = streamLogFormat
242
- }
221
+ if streamLogFormat , exists := GetMapKeyAsStringSlice (cfgm .Data , "stream-log-format" , cfgm , "\n " ); exists {
222
+ cfgParams .MainStreamLogFormat = streamLogFormat
243
223
}
244
224
245
225
if streamLogFormatEscaping , exists := cfgm .Data ["stream-log-format-escaping" ]; exists {
@@ -281,36 +261,20 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
281
261
cfgParams .ProxyMaxTempFileSize = proxyMaxTempFileSize
282
262
}
283
263
284
- if mainMainSnippets , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "main-snippets" , cfgm , "\n " ); exists {
285
- if err != nil {
286
- glog .Error (err )
287
- } else {
288
- cfgParams .MainMainSnippets = mainMainSnippets
289
- }
264
+ if mainMainSnippets , exists := GetMapKeyAsStringSlice (cfgm .Data , "main-snippets" , cfgm , "\n " ); exists {
265
+ cfgParams .MainMainSnippets = mainMainSnippets
290
266
}
291
267
292
- if mainHTTPSnippets , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "http-snippets" , cfgm , "\n " ); exists {
293
- if err != nil {
294
- glog .Error (err )
295
- } else {
296
- cfgParams .MainHTTPSnippets = mainHTTPSnippets
297
- }
268
+ if mainHTTPSnippets , exists := GetMapKeyAsStringSlice (cfgm .Data , "http-snippets" , cfgm , "\n " ); exists {
269
+ cfgParams .MainHTTPSnippets = mainHTTPSnippets
298
270
}
299
271
300
- if locationSnippets , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "location-snippets" , cfgm , "\n " ); exists {
301
- if err != nil {
302
- glog .Error (err )
303
- } else {
304
- cfgParams .LocationSnippets = locationSnippets
305
- }
272
+ if locationSnippets , exists := GetMapKeyAsStringSlice (cfgm .Data , "location-snippets" , cfgm , "\n " ); exists {
273
+ cfgParams .LocationSnippets = locationSnippets
306
274
}
307
275
308
- if serverSnippets , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "server-snippets" , cfgm , "\n " ); exists {
309
- if err != nil {
310
- glog .Error (err )
311
- } else {
312
- cfgParams .ServerSnippets = serverSnippets
313
- }
276
+ if serverSnippets , exists := GetMapKeyAsStringSlice (cfgm .Data , "server-snippets" , cfgm , "\n " ); exists {
277
+ cfgParams .ServerSnippets = serverSnippets
314
278
}
315
279
316
280
if _ , exists , err := GetMapKeyAsInt (cfgm .Data , "worker-processes" , cfgm ); exists {
@@ -373,23 +337,15 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
373
337
cfgParams .VirtualServerTemplate = & virtualServerTemplate
374
338
}
375
339
376
- if mainStreamSnippets , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "stream-snippets" , cfgm , "\n " ); exists {
377
- if err != nil {
378
- glog .Error (err )
379
- } else {
380
- cfgParams .MainStreamSnippets = mainStreamSnippets
381
- }
340
+ if mainStreamSnippets , exists := GetMapKeyAsStringSlice (cfgm .Data , "stream-snippets" , cfgm , "\n " ); exists {
341
+ cfgParams .MainStreamSnippets = mainStreamSnippets
382
342
}
383
343
384
- if resolverAddresses , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "resolver-addresses" , cfgm , "," ); exists {
385
- if err != nil {
386
- glog . Error ( err )
344
+ if resolverAddresses , exists := GetMapKeyAsStringSlice (cfgm .Data , "resolver-addresses" , cfgm , "," ); exists {
345
+ if nginxPlus {
346
+ cfgParams . ResolverAddresses = resolverAddresses
387
347
} else {
388
- if nginxPlus {
389
- cfgParams .ResolverAddresses = resolverAddresses
390
- } else {
391
- glog .Warning ("ConfigMap key 'resolver-addresses' requires NGINX Plus" )
392
- }
348
+ glog .Warning ("ConfigMap key 'resolver-addresses' requires NGINX Plus" )
393
349
}
394
350
}
395
351
@@ -521,12 +477,8 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool, hasAppProtect bool, hasA
521
477
}
522
478
523
479
if hasAppProtectDos {
524
- if appProtectDosLogFormat , exists , err := GetMapKeyAsStringSlice (cfgm .Data , "app-protect-dos-log-format" , cfgm , "\n " ); exists {
525
- if err != nil {
526
- glog .Error (err )
527
- } else {
528
- cfgParams .MainAppProtectDosLogFormat = appProtectDosLogFormat
529
- }
480
+ if appProtectDosLogFormat , exists := GetMapKeyAsStringSlice (cfgm .Data , "app-protect-dos-log-format" , cfgm , "\n " ); exists {
481
+ cfgParams .MainAppProtectDosLogFormat = appProtectDosLogFormat
530
482
}
531
483
532
484
if appProtectDosLogFormatEscaping , exists := cfgm .Data ["app-protect-dos-log-format-escaping" ]; exists {
0 commit comments