Migrate Compress from bool to struct
This commit is contained in:
parent
43d22d7a2f
commit
c159e316be
6 changed files with 19 additions and 12 deletions
|
@ -17,11 +17,15 @@ type EntryPoint struct {
|
|||
Auth *types.Auth `export:"true"`
|
||||
WhitelistSourceRange []string // Deprecated
|
||||
WhiteList *types.WhiteList `export:"true"`
|
||||
Compress bool `export:"true"`
|
||||
Compress *Compress `export:"true"`
|
||||
ProxyProtocol *ProxyProtocol `export:"true"`
|
||||
ForwardedHeaders *ForwardedHeaders `export:"true"`
|
||||
}
|
||||
|
||||
// Compress contains compress configuration
|
||||
type Compress struct {
|
||||
}
|
||||
|
||||
// ProxyProtocol contains Proxy-Protocol configuration
|
||||
type ProxyProtocol struct {
|
||||
Insecure bool `export:"true"`
|
||||
|
@ -69,7 +73,10 @@ func (ep *EntryPoints) Set(value string) error {
|
|||
whiteListSourceRange = strings.Split(result["whitelistsourcerange"], ",")
|
||||
}
|
||||
|
||||
compress := toBool(result, "compress")
|
||||
var compress *Compress
|
||||
if len(result["compress"]) > 0 {
|
||||
compress = &Compress{}
|
||||
}
|
||||
|
||||
configTLS, err := makeEntryPointTLS(result)
|
||||
if err != nil {
|
||||
|
|
|
@ -278,7 +278,7 @@ func TestEntryPoints_Set(t *testing.T) {
|
|||
},
|
||||
UseXForwardedFor: true,
|
||||
},
|
||||
Compress: true,
|
||||
Compress: &Compress{},
|
||||
ProxyProtocol: &ProxyProtocol{
|
||||
Insecure: false,
|
||||
TrustedIPs: []string{"192.168.0.1"},
|
||||
|
@ -380,7 +380,7 @@ func TestEntryPoints_Set(t *testing.T) {
|
|||
"152.89.1.33/32",
|
||||
"afed:be44::/16",
|
||||
},
|
||||
Compress: true,
|
||||
Compress: &Compress{},
|
||||
ProxyProtocol: &ProxyProtocol{
|
||||
Insecure: false,
|
||||
TrustedIPs: []string{"192.168.0.1"},
|
||||
|
@ -462,7 +462,7 @@ func TestEntryPoints_Set(t *testing.T) {
|
|||
expression: "Name:foo Compress:on",
|
||||
expectedEntryPointName: "foo",
|
||||
expectedEntryPoint: &EntryPoint{
|
||||
Compress: true,
|
||||
Compress: &Compress{},
|
||||
ForwardedHeaders: &ForwardedHeaders{Insecure: true},
|
||||
},
|
||||
},
|
||||
|
@ -471,7 +471,7 @@ func TestEntryPoints_Set(t *testing.T) {
|
|||
expression: "Name:foo Compress:true",
|
||||
expectedEntryPointName: "foo",
|
||||
expectedEntryPoint: &EntryPoint{
|
||||
Compress: true,
|
||||
Compress: &Compress{},
|
||||
ForwardedHeaders: &ForwardedHeaders{Insecure: true},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue