@@ -29,12 +29,6 @@ type MiddlewaresConfig struct {
29
29
Logger RequestLoggerConfig `json:"logger,omitempty" yaml:"logger,omitempty"`
30
30
}
31
31
32
- func (cfg * MiddlewaresConfig ) InitDefaults () {
33
- cfg .BodyLimit .InitDefaults ()
34
- cfg .Compress .InitDefaults ()
35
- cfg .Secure .InitDefaults ()
36
- }
37
-
38
32
type APIConfig struct {
39
33
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
40
34
Path string `json:"path,omitempty" yaml:"path,omitempty"`
@@ -46,7 +40,7 @@ type APIConfig struct {
46
40
Components huma.Components `json:"components,omitempty" yaml:"components,omitempty"`
47
41
}
48
42
49
- func (cfg * APIConfig ) InitDefaults () {
43
+ func (cfg * APIConfig ) setDefaults () {
50
44
if cfg .OpenAPIPath == "" {
51
45
cfg .OpenAPIPath = "/openapi"
52
46
}
@@ -63,13 +57,6 @@ type AreaConfig struct {
63
57
API map [string ]APIConfig `json:"api,omitempty" yaml:"api,omitempty"`
64
58
}
65
59
66
- func (cfg * AreaConfig ) InitDefaults () {
67
- for key , value := range cfg .API {
68
- value .InitDefaults ()
69
- cfg .API [key ] = value
70
- }
71
- }
72
-
73
60
type RoleHierarchyConfig struct {
74
61
Role string `json:"role,omitempty" yaml:"role,omitempty"`
75
62
Parents []string `json:"parents,omitempty" yaml:"parents,omitempty"`
@@ -82,14 +69,6 @@ type Config struct {
82
69
Areas map [string ]AreaConfig `json:"areas,omitempty" yaml:"areas,omitempty"`
83
70
}
84
71
85
- func (cfg * Config ) InitDefaults () {
86
- cfg .Middlewares .InitDefaults ()
87
- for key , value := range cfg .Areas {
88
- value .InitDefaults ()
89
- cfg .Areas [key ] = value
90
- }
91
- }
92
-
93
72
type SameSiteType string
94
73
95
74
const (
@@ -153,7 +132,7 @@ type BodyLimitConfig struct {
153
132
Limit string `json:"limit,omitempty" yaml:"limit,omitempty"`
154
133
}
155
134
156
- func (cfg * BodyLimitConfig ) InitDefaults () {
135
+ func (cfg * BodyLimitConfig ) setDefaults () {
157
136
if cfg .Limit == "" {
158
137
cfg .Limit = "4KB"
159
138
}
@@ -181,7 +160,7 @@ type GzipConfig struct {
181
160
MinLength int `json:"minLength,omitempty" yaml:"minLength,omitempty"`
182
161
}
183
162
184
- func (cfg * GzipConfig ) InitDefaults () {
163
+ func (cfg * GzipConfig ) setDefaults () {
185
164
if cfg .MinLength <= 0 {
186
165
cfg .MinLength = 1024
187
166
}
@@ -252,7 +231,7 @@ type SecureConfig struct {
252
231
ReferrerPolicy string `json:"referrerPolicy,omitempty" yaml:"referrerPolicy,omitempty"`
253
232
}
254
233
255
- func (cfg * SecureConfig ) InitDefaults () {
234
+ func (cfg * SecureConfig ) setDefaults () {
256
235
if cfg .XSSProtection == "" {
257
236
cfg .XSSProtection = middleware .DefaultSecureConfig .XSSProtection
258
237
}
0 commit comments