config

package
v0.0.0-...-a8aec34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Node   ConfigNode
	Confab ConfigConfab
	Consul ConfigConsul
	Path   ConfigPath
}

func ConfigFromJSON

func ConfigFromJSON(configData, configConsulLinkData []byte) (Config, error)

type ConfigConfab

type ConfigConfab struct {
	TimeoutInSeconds int `json:"timeout_in_seconds"`
}

type ConfigConsul

type ConfigConsul struct {
	Agent       ConfigConsulAgent
	EncryptKeys []string `json:"encrypt_keys"`
}

type ConfigConsulAgent

type ConfigConsulAgent struct {
	Servers         ConfigConsulAgentServers     `json:"servers"`
	Services        map[string]ServiceDefinition `json:"services"`
	Mode            string                       `json:"mode"`
	Domain          string                       `json:"domain"`
	Datacenter      string                       `json:"datacenter"`
	LogLevel        string                       `json:"log_level"`
	ProtocolVersion int                          `json:"protocol_version"`
	DnsConfig       ConfigConsulAgentDnsConfig   `json:"dns_config"`
	Telemetry       ConfigConsulTelemetry        `json:"telemetry"`
	Bootstrap       bool                         `json:"bootstrap"`
	NodeName        string                       `json:"node_name"`
	RequireSSL      bool                         `json:"require_ssl"`
	Ports           ConfigConsulAgentPorts       `json:"ports"`
}

type ConfigConsulAgentDnsConfig

type ConfigConsulAgentDnsConfig struct {
	AllowStale      bool   `json:"allow_stale"`
	MaxStale        string `json:"max_stale"`
	RecursorTimeout string `json:"recursor_timeout"`
	ServiceTTL      string `json:"service_ttl"`
}

type ConfigConsulAgentPorts

type ConfigConsulAgentPorts struct {
	DNS int `json:"dns"`
}

type ConfigConsulAgentServers

type ConfigConsulAgentServers struct {
	LAN []string `json:"lan"`
	WAN []string `json:"wan"`
}

type ConfigConsulTelemetry

type ConfigConsulTelemetry struct {
	StatsdAddress string `json:"statsd_address"`
}

type ConfigNode

type ConfigNode struct {
	Name       string `json:"name"`
	Index      int    `json:"index"`
	ExternalIP string `json:"external_ip"`
	Zone       string `json:"zone"`
}

type ConfigPath

type ConfigPath struct {
	AgentPath       string `json:"agent_path"`
	ConsulConfigDir string `json:"consul_config_dir"`
	PIDFile         string `json:"pid_file"`
	KeyringFile     string `json:"keyring_file"`
	DataDir         string `json:"data_dir"`
}

type ConsulConfig

type ConsulConfig struct {
	Server               bool                    `json:"server"`
	Domain               string                  `json:"domain"`
	Datacenter           string                  `json:"datacenter"`
	DataDir              string                  `json:"data_dir"`
	LogLevel             string                  `json:"log_level"`
	NodeName             string                  `json:"node_name"`
	Ports                ConsulConfigPorts       `json:"ports"`
	RejoinAfterLeave     bool                    `json:"rejoin_after_leave"`
	BindAddr             string                  `json:"bind_addr"`
	DisableRemoteExec    bool                    `json:"disable_remote_exec"`
	DisableUpdateCheck   bool                    `json:"disable_update_check"`
	Protocol             int                     `json:"protocol"`
	VerifyOutgoing       *bool                   `json:"verify_outgoing,omitempty"`
	VerifyIncoming       *bool                   `json:"verify_incoming,omitempty"`
	VerifyServerHostname *bool                   `json:"verify_server_hostname,omitempty"`
	CAFile               *string                 `json:"ca_file,omitempty"`
	KeyFile              *string                 `json:"key_file,omitempty"`
	CertFile             *string                 `json:"cert_file,omitempty"`
	Encrypt              *string                 `json:"encrypt,omitempty"`
	DnsConfig            ConsulConfigDnsConfig   `json:"dns_config"`
	Bootstrap            *bool                   `json:"bootstrap,omitempty"`
	Performance          ConsulConfigPerformance `json:"performance"`
	Telemetry            *ConsulConfigTelemetry  `json:"telemetry,omitempty"`
	TLSMinVersion        string                  `json:"tls_min_version"`
}

func GenerateConfiguration

func GenerateConfiguration(config Config, configDir, nodeName string) ConsulConfig

type ConsulConfigDnsConfig

type ConsulConfigDnsConfig struct {
	AllowStale      bool                   `json:"allow_stale"`
	MaxStale        string                 `json:"max_stale"`
	RecursorTimeout string                 `json:"recursor_timeout"`
	ServiceTTL      ConsulConfigServiceTTL `json:"service_ttl"`
}

type ConsulConfigPerformance

type ConsulConfigPerformance struct {
	RaftMultiplier int `json:"raft_multiplier"`
}

type ConsulConfigPorts

type ConsulConfigPorts struct {
	DNS   int `json:"dns,omitempty"`
	HTTP  int `json:"http,omitempty"`
	HTTPS int `json:"https,omitempty"`
}

type ConsulConfigServiceTTL

type ConsulConfigServiceTTL struct {
	AllServices string `json:"*"`
}

type ConsulConfigTelemetry

type ConsulConfigTelemetry struct {
	StatsdAddress string `json:"statsd_address,omitempty"`
}

type ServiceDefiner

type ServiceDefiner struct {
	Logger logger
}

func (ServiceDefiner) GenerateDefinitions

func (s ServiceDefiner) GenerateDefinitions(config Config) ([]ServiceDefinition, error)

func (ServiceDefiner) WriteDefinitions

func (s ServiceDefiner) WriteDefinitions(configDir string, definitions []ServiceDefinition) error

type ServiceDefinition

type ServiceDefinition struct {
	ServiceName       string                   `json:"-"`
	Name              string                   `json:"name"`
	Check             *ServiceDefinitionCheck  `json:"check,omitempty"`
	Checks            []ServiceDefinitionCheck `json:"checks,omitempty"`
	Tags              []string                 `json:"tags,omitempty"`
	Address           string                   `json:"address,omitempty"`
	Port              int                      `json:"port,omitempty"`
	EnableTagOverride bool                     `json:"enableTagOverride,omitempty"`
	ID                string                   `json:"id,omitempty"`
	Token             string                   `json:"token,omitempty"`
}

type ServiceDefinitionCheck

type ServiceDefinitionCheck struct {
	Name              string `json:"name"`
	ID                string `json:"id,omitempty"`
	Script            string `json:"script,omitempty"`
	HTTP              string `json:"http,omitempty"`
	TCP               string `json:"tcp,omitempty"`
	TTL               string `json:"ttl,omitempty"`
	Interval          string `json:"interval,omitempty"`
	Timeout           string `json:"timeout,omitempty"`
	Notes             string `json:"notes,omitempty"`
	DockerContainerID string `json:"docker_container_id,omitempty"`
	Shell             string `json:"shell,omitempty"`
	Status            string `json:"status,omitempty"`
	ServiceID         string `json:"service_id,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL