Merge pull request #1310 from aledbf/fix-config
Refactoring nginx configuration configmap
This commit is contained in:
commit
6146bc4dc2
1 changed files with 6 additions and 7 deletions
|
@ -465,23 +465,22 @@ Error: %v
|
|||
// SetConfig sets the configured configmap
|
||||
func (n *NGINXController) SetConfig(cmap *api_v1.ConfigMap) {
|
||||
n.configmap = cmap
|
||||
|
||||
n.isProxyProtocolEnabled = false
|
||||
if cmap == nil {
|
||||
n.backendDefaults = config.NewDefault().Backend
|
||||
return
|
||||
|
||||
m := map[string]string{}
|
||||
if cmap != nil {
|
||||
m = cmap.Data
|
||||
}
|
||||
|
||||
val, ok := cmap.Data["use-proxy-protocol"]
|
||||
val, ok := m["use-proxy-protocol"]
|
||||
if ok {
|
||||
b, err := strconv.ParseBool(val)
|
||||
if err == nil {
|
||||
n.isProxyProtocolEnabled = b
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
n.backendDefaults = ngx_template.ReadConfig(n.configmap.Data).Backend
|
||||
n.backendDefaults = ngx_template.ReadConfig(m).Backend
|
||||
}
|
||||
|
||||
// SetListers sets the configured store listers in the generic ingress controller
|
||||
|
|
Loading…
Reference in a new issue