Skip to content

Commit

Permalink
fixed config handling
Browse files Browse the repository at this point in the history
  • Loading branch information
s0s01qp committed Jul 24, 2021
1 parent f47c1ef commit 9ee79f9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,25 @@ import (

// GetFastHTTPActuatorHandler is used to get the request handler for fast http
func GetFastHTTPActuatorHandler(config *models.Config) fasthttp.RequestHandler {
handleConfigs(config)
return func(ctx *fasthttp.RequestCtx) {
fastHTTPControllers.HandleRequest(config, ctx)
}
}

// ConfigureGINActuatorEngine is used to configure the gin engine with the actuator handlers
func ConfigureGINActuatorEngine(config *models.Config, engine *gin.Engine) {
handleConfigs(config)
ginControllers.ConfigureHandlers(config, engine)
}

// ConfigureNetHTTPHandler is used to configure the net http mux with the actuator handlers
func ConfigureNetHTTPHandler(config *models.Config, mux *http.ServeMux) {
handleConfigs(config)
netHTTPControllers.ConfigureHandlers(config, mux)
}

func handleConfigs(config *models.Config) {
config.Validate()
config.Default()
}

0 comments on commit 9ee79f9

Please sign in to comment.