Documentation ¶
Overview ¶
The consul package implements the Pool and Declare interfaces for the Herald package. https://github.com/duckbunny/herald
The package takes one flag "consul-ttl" to set the time until the service expires from consul using a heartbeat.
The package utilizies the Default client returned from consul api, but this can be overriden by editing.
ConsulConfig.Config.Address = "192.168.1.56"
This service must be registered with herald.
consul.Register()
Or you can fall back on the herald service registry, to register all available services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // TTL time to life for service in consul TTL int = 15 // Where the ServiceKVPath resides ServicesKVpath string = "services" // Title for specifying herald in flags Title string = "consul" // Config falls back to client default config ConsulConfig *api.Config = api.DefaultConfig() )
Functions ¶
func FormattedID ¶
FormattedID returns correctly formatted id of the service
func FormattedKey ¶
FormattedKey returns correctly formatted key of the service
func FormattedName ¶
FormattedName returns correctly formatted name of the service
Types ¶
type Consul ¶
type Consul struct { // Agent to register service Agent *api.Agent // KV to save service definition KV *api.KV // contains filtered or unexported fields }
Consul structure
func (*Consul) GetService ¶
Retrieve the consul service definition. Requires Domain, Title and Version be set. Returns err if not found.