diff --git a/common/spa_handler/handler.go b/common/spa_handler/handler.go index 95150de16..11d310eba 100644 --- a/common/spa_handler/handler.go +++ b/common/spa_handler/handler.go @@ -28,24 +28,24 @@ type SinglePageAppHandler struct { BindingKey string } -func (self *SinglePageAppHandler) Binding() string { - return self.BindingKey +func (spa *SinglePageAppHandler) Binding() string { + return spa.BindingKey } -func (self *SinglePageAppHandler) Options() map[interface{}]interface{} { +func (spa *SinglePageAppHandler) Options() map[interface{}]interface{} { return nil } -func (self *SinglePageAppHandler) RootPath() string { - return "/" + self.BindingKey +func (spa *SinglePageAppHandler) RootPath() string { + return "/" + spa.BindingKey } -func (self *SinglePageAppHandler) IsHandler(r *http.Request) bool { - return strings.HasPrefix(r.URL.Path, self.RootPath()) || strings.HasPrefix(r.URL.Path, "/assets") +func (spa *SinglePageAppHandler) IsHandler(r *http.Request) bool { + return strings.HasPrefix(r.URL.Path, spa.RootPath()) || strings.HasPrefix(r.URL.Path, "/assets") } -func (self *SinglePageAppHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - self.HttpHandler.ServeHTTP(writer, request) +func (spa *SinglePageAppHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) { + spa.HttpHandler.ServeHTTP(writer, request) } // Thanks to https://github.com/roberthodgen/spa-server diff --git a/controller/zac/factory.go b/controller/zac/factory.go index ebd58e32f..6f814b491 100644 --- a/controller/zac/factory.go +++ b/controller/zac/factory.go @@ -30,7 +30,7 @@ func (factory ZitiAdminConsoleFactory) Binding() string { func (factory ZitiAdminConsoleFactory) New(_ *xweb.ServerConfig, options map[interface{}]interface{}) (xweb.ApiHandler, error) { loc := options["location"] if loc == nil || loc == "" { - log.Panic("location must be supplied in spa options") + log.Fatal("location must be supplied in " + Binding + " options") } indexFile := options["indexFile"] if indexFile == nil || indexFile == "" {