Documentation ¶
Index ¶
- type Config
- type ConsulService
- func (ConsulService) CaddyModule() caddy.ModuleInfo
- func (c *ConsulService) Cleanup() error
- func (c *ConsulService) GetPeers() ([]string, error)
- func (c *ConsulService) Provision(ctx caddy.Context) error
- func (c *ConsulService) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (c *ConsulService) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ServiceName string `json:"service_name,omitempty"` Addr string `json:"addr,omitempty"` HealthURL string `json:"health_url,omitempty"` }
Config is the configuration for the consul
type ConsulService ¶
type ConsulService struct { Client *api.Client KV *api.KV Catalog *api.Catalog Config *Config ServiceIDs []string }
ConsulService handles the client to interact with the consul agent
func (ConsulService) CaddyModule ¶
func (ConsulService) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information
func (*ConsulService) Cleanup ¶
func (c *ConsulService) Cleanup() error
Cleanup releases the holding resources
func (*ConsulService) GetPeers ¶
func (c *ConsulService) GetPeers() ([]string, error)
GetPeers get the peers in the same cluster
func (*ConsulService) Provision ¶
func (c *ConsulService) Provision(ctx caddy.Context) error
Provision init the consul's agent and establish connection
func (*ConsulService) UnmarshalCaddyfile ¶
func (c *ConsulService) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile deserializes Caddyfile tokens into caddy cache's Handler
distributed consul { service_name addr }
func (*ConsulService) Validate ¶
func (c *ConsulService) Validate() error
Validate checks the resource is set up correctly
Click to show internal directories.
Click to hide internal directories.