mirror of https://github.com/k3s-io/k3s
Merge pull request #30050 from ping035627/ping035627-patch-0804
Automatic merge from submit-queue Correct the url in comment and optimise the code style The PR modified two aspects: 1) Correct the url in comment, the original url can't be accessed; 2) Optimise the code style according to the go style guide.pull/6/head
commit
e800c391f5
|
@ -466,8 +466,8 @@ func (s *GenericAPIServer) init(c *Config) {
|
|||
handler := http.Handler(s.mux.(*http.ServeMux))
|
||||
|
||||
// TODO: handle CORS and auth using go-restful
|
||||
// See github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-CORS-filter.go, and
|
||||
// github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-basic-authentication.go
|
||||
// See github.com/emicklei/go-restful/blob/master/examples/restful-CORS-filter.go, and
|
||||
// github.com/emicklei/go-restful/blob/master/examples/restful-basic-authentication.go
|
||||
|
||||
if len(c.CorsAllowedOriginList) > 0 {
|
||||
allowedOriginRegexps, err := util.CompileRegexps(c.CorsAllowedOriginList)
|
||||
|
@ -507,17 +507,18 @@ func (s *GenericAPIServer) init(c *Config) {
|
|||
s.Handler = handler
|
||||
|
||||
// After all wrapping is done, put a context filter around both handlers
|
||||
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.Handler); err != nil {
|
||||
var err error
|
||||
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.Handler)
|
||||
if err != nil {
|
||||
glog.Fatalf("Could not initialize request context filter for s.Handler: %v", err)
|
||||
} else {
|
||||
s.Handler = handler
|
||||
}
|
||||
s.Handler = handler
|
||||
|
||||
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler); err != nil {
|
||||
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler)
|
||||
if err != nil {
|
||||
glog.Fatalf("Could not initialize request context filter for s.InsecureHandler: %v", err)
|
||||
} else {
|
||||
s.InsecureHandler = handler
|
||||
}
|
||||
s.InsecureHandler = handler
|
||||
|
||||
s.installGroupsDiscoveryHandler()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue