anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
1 stars 9 forks source link

health: Add DefaultServer #59

Closed juliaogris closed 4 years ago

juliaogris commented 4 years ago

Add DefaultServer to health.pkg similarly to the DefaultServeMux in the http package: for the simple case, the health package can now be used without explicitly instantiating a health.Server:

appServer := http.NewServeMux()
// attach handlers to appServer

health.RegisterWith(appServer)

// expensive initialisation

health.SetReady(tue)

Top-level functions RegisterWith, RegisterWithGRPC and SetReady operate on the DefaultServer for convenience.

Update example and tests. Increase coverage by a little. Remove goconst linter - it is fine to repeat "not a URL" in tests more than twice.