Documentation
¶
Overview ¶
Package praetor provides a basic, opinionated way of integrated a consul Client with go.uber.org/fx.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decorate ¶
Decorate is an uber/fx decorator that returns a new consul client Config that results from applying any number of options to an existing Config. If no options are supplied, this function returns a clone of the original.
func New ¶
New is the standard constructor for a consul client. It allows for any number of options to tailor the configuration after the api.Config has been unmarshaled or obtained from some external source.
This function may be used directly with fx.Provide as a constructor. More commonly, the Provide function in this package is preferred since it allows simpler annotation.
func Provide ¶
Provide gives a very simple, opinionated way of using New within an fx.App. It assumes a global, unnamed api.Config optional dependency and zero or more ClientOptions in a value group named 'consul.options'.
Zero or more options that are external to the enclosing fx.App may be supplied to this provider function. This allows the consul Client to be modified by command-line options, hardcoded values, etc. Any external options supplied to this function take precedence over injected options.
This provider emits a global, unnamed *api.Client.
Types ¶
type Option ¶
Option is a functional option for tailoring the consul client configuration prior to creating it. Each option can modify the *api.Config prior to it being passed to api.NewClient.
func WithHTTPClient ¶
WithHTTPClient configures the consul client with a custom HTTP client.