remove setters for checker/middleware build folders

This commit is contained in:
Adrien Marquès 2018-07-09 00:32:19 +02:00
parent d04bafa0eb
commit 0bf5646eb7
1 changed files with 3 additions and 16 deletions

View File

@ -12,8 +12,7 @@ import (
"net/http" "net/http"
) )
// Init initilises a new framework instance // New creates a framework instance from a configuration file
// - path is the configuration file
func New(path string) (*Server, error) { func New(path string) (*Server, error) {
/* (1) Init instance */ /* (1) Init instance */
@ -30,27 +29,15 @@ func New(path string) (*Server, error) {
inst.config = config inst.config = config
/* (3) Default type registry */ /* (3) Default type registry */
inst.SetTypeFolder(".build/type") inst.Checker = checker.CreateRegistry(".build/type")
/* (4) Default middleware registry */ /* (4) Default middleware registry */
inst.SetMiddlewareFolder(".build/middleware") inst.Middleware = middleware.CreateRegistry(".build/middleware")
return inst, nil return inst, nil
} }
// Create the type (checker) registry from
// a given folder
func (s *Server) SetTypeFolder(path string) {
s.Checker = checker.CreateRegistry(path)
}
// Create the middleware registry from
// a given folder
func (s *Server) SetMiddlewareFolder(path string) {
s.Middleware = middleware.CreateRegistry(path)
}
// Listens and binds the server to the given port // Listens and binds the server to the given port
func (s *Server) Listen(port uint16) error { func (s *Server) Listen(port uint16) error {