Skip to content

Commit

Permalink
Fix lint code errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Jul 6, 2017
1 parent b308be5 commit 835aea4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions controllers/nginx/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ type Configuration struct {

// NewDefault returns the default nginx configuration
func NewDefault() Configuration {
defIPCIDR := make([]string, 0)
defIPCIDR = append(defIPCIDR, "0.0.0.0/0")
defIPCIDR := make([]string, 0)
defIPCIDR = append(defIPCIDR, "0.0.0.0/0")
cfg := Configuration{
AllowBackendServerHeader: false,
ClientHeaderBufferSize: "1k",
Expand Down
10 changes: 5 additions & 5 deletions controllers/nginx/pkg/template/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
customHTTPErrors = "custom-http-errors"
skipAccessLogUrls = "skip-access-log-urls"
whitelistSourceRange = "whitelist-source-range"
proxyRealIPCIDR = "proxy-real-ip-cidr"
proxyRealIPCIDR = "proxy-real-ip-cidr"
)

// ReadConfig obtains the configuration defined by the user merged with the defaults.
Expand All @@ -46,7 +46,7 @@ func ReadConfig(src map[string]string) config.Configuration {
errors := make([]int, 0)
skipUrls := make([]string, 0)
whitelist := make([]string, 0)
proxylist := make([]string, 0)
proxylist := make([]string, 0)

if val, ok := conf[customHTTPErrors]; ok {
delete(conf, customHTTPErrors)
Expand All @@ -71,14 +71,14 @@ func ReadConfig(src map[string]string) config.Configuration {
delete(conf, proxyRealIPCIDR)
proxylist = append(proxylist, strings.Split(val, ",")...)
} else {
proxylist = append(proxylist, "0.0.0.0/0")
}
proxylist = append(proxylist, "0.0.0.0/0")
}

to := config.NewDefault()
to.CustomHTTPErrors = filterErrors(errors)
to.SkipAccessLogURLs = skipUrls
to.WhitelistSourceRange = whitelist
to.ProxyRealIPCIDR = proxylist
to.ProxyRealIPCIDR = proxylist

config := &mapstructure.DecoderConfig{
Metadata: nil,
Expand Down
4 changes: 2 additions & 2 deletions controllers/nginx/pkg/template/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
"use-gzip": "true",
"enable-dynamic-tls-records": "false",
"gzip-types": "text/html",
"proxy-real-ip-cidr": "1.1.1.1/8,2.2.2.2/24",
"proxy-real-ip-cidr": "1.1.1.1/8,2.2.2.2/24",
}
def := config.NewDefault()
def.CustomHTTPErrors = []int{300, 400}
Expand All @@ -53,7 +53,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
def.EnableDynamicTLSRecords = false
def.UseProxyProtocol = true
def.GzipTypes = "text/html"
def.ProxyRealIPCIDR = []string{"1.1.1.1/8", "2.2.2.2/24"}
def.ProxyRealIPCIDR = []string{"1.1.1.1/8", "2.2.2.2/24"}

to := ReadConfig(conf)
if diff := pretty.Compare(to, def); diff != "" {
Expand Down

0 comments on commit 835aea4

Please sign in to comment.