Skip to content

Commit

Permalink
fix: set default strip_path to true
Browse files Browse the repository at this point in the history
In the past decK had to set the default value of the `strip_path`
field to [false](https://github.com/Kong/deck/blob/v1.26.0/utils/constants.go#L22)
because of some limitation in the library used for defaults injection:
this was a workaround to allow this field to be set to `false`.
Then, if the field was not set in the configuration, the field was then
turned into `true` at runtime via inspection of the Kong Admin API.

This commit changes the decK default for the `strip_path` field to `true`,
since now the underlying library has fixed the issue that triggered
this workaround in the first place.
  • Loading branch information
GGabriele committed Aug 10, 2023
1 parent 63b9742 commit c171b0f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions convert/testdata/5/output-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
tags:
- team-svc1
write_timeout: 60000
Expand All @@ -41,7 +41,7 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 60000
- connect_timeout: 60000
host: mockbin.org
Expand All @@ -61,5 +61,5 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 60000
6 changes: 3 additions & 3 deletions convert/testdata/6/output-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
protocols:
- https
regex_priority: 0
strip_path: false
strip_path: true
tags:
- team-svc1
write_timeout: 30000
Expand All @@ -39,7 +39,7 @@ services:
protocols:
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 30000
- connect_timeout: 30000
host: mockbin.org
Expand All @@ -58,5 +58,5 @@ services:
protocols:
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 30000
6 changes: 3 additions & 3 deletions convert/testdata/7/output-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
tags:
- team-svc1
write_timeout: 60000
Expand All @@ -41,7 +41,7 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 60000
- connect_timeout: 60000
host: mockbin.org
Expand All @@ -61,5 +61,5 @@ services:
- http
- https
regex_priority: 0
strip_path: false
strip_path: true
write_timeout: 60000
2 changes: 1 addition & 1 deletion utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
routeDefaults = kong.Route{
PreserveHost: kong.Bool(false),
RegexPriority: kong.Int(0),
StripPath: kong.Bool(false),
StripPath: kong.Bool(true),
Protocols: kong.StringSlice("http", "https"),
}
targetDefaults = kong.Target{
Expand Down
8 changes: 4 additions & 4 deletions utils/defaulter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func TestRouteSetTest(t *testing.T) {
want: &kong.Route{
PreserveHost: kong.Bool(true),
RegexPriority: kong.Int(0),
StripPath: kong.Bool(false),
StripPath: kong.Bool(true),
Protocols: kong.StringSlice("http", "https"),
},
},
Expand All @@ -192,7 +192,7 @@ func TestRouteSetTest(t *testing.T) {
want: &kong.Route{
PreserveHost: kong.Bool(false),
RegexPriority: kong.Int(0),
StripPath: kong.Bool(false),
StripPath: kong.Bool(true),
Protocols: kong.StringSlice("http", "tls"),
},
},
Expand All @@ -202,15 +202,15 @@ func TestRouteSetTest(t *testing.T) {
Name: kong.String("foo"),
Hosts: kong.StringSlice("1.example.com", "2.example.com"),
Methods: kong.StringSlice("GET", "POST"),
StripPath: kong.Bool(false),
StripPath: kong.Bool(true),
},
want: &kong.Route{
Name: kong.String("foo"),
Hosts: kong.StringSlice("1.example.com", "2.example.com"),
Methods: kong.StringSlice("GET", "POST"),
PreserveHost: kong.Bool(false),
RegexPriority: kong.Int(0),
StripPath: kong.Bool(false),
StripPath: kong.Bool(true),
Protocols: kong.StringSlice("http", "https"),
},
},
Expand Down

0 comments on commit c171b0f

Please sign in to comment.