 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type ExternalServiceList
- func (e *ExternalServiceList) GetHTTPServer(cfg *config.Config, bindAddr string, router http.Handler) HTTPServer
- func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
- func (e *ExternalServiceList) GetRequestMiddleware() RequestMiddleware
 
- type HTTPServer
- type HealthChecker
- type Init
- type Initialiser
- type NoOpRequestMiddleware
- type RequestMiddleware
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalServiceList ¶
type ExternalServiceList struct {
	HealthCheck bool
	Init        Initialiser
}
    ExternalServiceList holds the initialiser and initialisation state of external services.
func NewServiceList ¶
func NewServiceList(initialiser Initialiser) *ExternalServiceList
NewServiceList creates a new service list with the provided initialiser
func (*ExternalServiceList) GetHTTPServer ¶
func (e *ExternalServiceList) GetHTTPServer(cfg *config.Config, bindAddr string, router http.Handler) HTTPServer
GetHTTPServer creates an http server
func (*ExternalServiceList) GetHealthCheck ¶
func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
GetHealthCheck creates a healthcheck with versionInfo and sets teh HealthCheck flag to true
func (*ExternalServiceList) GetRequestMiddleware ¶
func (e *ExternalServiceList) GetRequestMiddleware() RequestMiddleware
type HTTPServer ¶
HTTPServer defines the required methods from the HTTP server
type HealthChecker ¶
type HealthChecker interface {
	Handler(w http.ResponseWriter, req *http.Request)
	Start(ctx context.Context)
	Stop()
	AddCheck(name string, checker healthcheck.Checker) (err error)
}
    HealthChecker defines the required methods from Healthcheck
type Init ¶
type Init struct{}
    Init implements the Initialiser interface to initialise dependencies
func (*Init) DoGetHTTPServer ¶
DoGetHTTPServer creates an HTTP Server with the provided bind address and router
func (*Init) DoGetHealthCheck ¶
func (e *Init) DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
DoGetHealthCheck creates a healthcheck with versionInfo
func (*Init) DoGetRequestMiddleware ¶
func (e *Init) DoGetRequestMiddleware() RequestMiddleware
type Initialiser ¶
type Initialiser interface {
	DoGetHTTPServer(cfg *config.Config, bindAddr string, router http.Handler) HTTPServer
	DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (HealthChecker, error)
	DoGetRequestMiddleware() RequestMiddleware
}
    Initialiser defines the methods to initialise external services
type NoOpRequestMiddleware ¶
type NoOpRequestMiddleware struct{}
    func (NoOpRequestMiddleware) GetMiddlewareFunction ¶
func (rm NoOpRequestMiddleware) GetMiddlewareFunction() func(http.Handler) http.Handler
type RequestMiddleware ¶
RequestMiddleware defines a method to get a middleware function that can modify the request. It is only needed to facilitate testing: the APIFeature in dp-component-test modifies the request to add a fake host and scheme. We need to remove this when running component tests, but don't need to do anything while in production mode. This can be achieved by injecting a middleware function (which will be different in production and test mode).
type Service ¶
type Service struct {
	Config      *config.Config
	Server      HTTPServer
	Router      *mux.Router
	Proxy       *proxy.Proxy
	ServiceList *ExternalServiceList
	HealthCheck HealthChecker
}
    Service contains all the configs, server and clients to run the proxy