Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addresses ¶
type Addresses struct {
HTTP string `mapstructure:"http" json:"http"`
}
Addresses encapsulates all of the addresses we bind to for various network services. Everything is optional and defaults to BindAddr.
type AdvertiseAddrs ¶
type AdvertiseAddrs struct {
HTTP string `mapstructure:"http" json:"http"`
}
AdvertiseAddrs is used to control the addresses we advertise out for different network services. All are optional and default to BindAddr and their default Port.
func (*AdvertiseAddrs) Merge ¶
func (a *AdvertiseAddrs) Merge(b *AdvertiseAddrs) *AdvertiseAddrs
Merge merges two advertise addrs configs together.
type MayaConfig ¶
type MayaConfig struct { // Region is the region this Maya server is supposed to deal in. // Defaults to global. Region string `mapstructure:"region" json:"region"` // Datacenter is the datacenter this Maya server is supposed to deal in. // Defaults to dc1 Datacenter string `mapstructure:"datacenter" json:"datacenter"` // NodeName is the name we register as. Defaults to hostname. NodeName string `mapstructure:"name" json:"name"` // DataDir is the directory to store Maya server's state in DataDir string `mapstructure:"data_dir" json:"data_dir"` // LogLevel is the level of the logs to putout LogLevel string `mapstructure:"log_level" json:"log_level"` // BindAddr is the address on which maya's services will // be bound. If not specified, this defaults to 127.0.0.1. BindAddr string `mapstructure:"bind_addr" json:"bind_addr"` // EnableDebug is used to enable debugging HTTP endpoints EnableDebug bool `mapstructure:"enable_debug" json:"enable_debug"` // Mayaserver can make use of various providers e.g. Nomad, // k8s etc ServiceProvider string `mapstructure:"service_provider" json:"service_provider"` // Ports is used to control the network ports we bind to. Ports *Ports `mapstructure:"ports" json:"ports"` // Addresses is used to override the network addresses we bind to. // // Use normalizedAddrs if you need the host+port to bind to. Addresses *Addresses `mapstructure:"addresses" json:"addresses"` // NormalizedAddr is set to the Address+Port by normalizeAddrs() NormalizedAddrs *Addresses // AdvertiseAddrs is used to control the addresses we advertise. AdvertiseAddrs *AdvertiseAddrs `mapstructure:"advertise" json:"advertise"` // LeaveOnInt is used to gracefully leave on the interrupt signal LeaveOnInt bool `mapstructure:"leave_on_interrupt" json:"leave_on_interrupt"` // LeaveOnTerm is used to gracefully leave on the terminate signal LeaveOnTerm bool `mapstructure:"leave_on_terminate" json:"leave_on_terminate"` // EnableSyslog is used to enable sending logs to syslog EnableSyslog bool `mapstructure:"enable_syslog" json:"enable_syslog"` // SyslogFacility is used to control the syslog facility used. SyslogFacility string `mapstructure:"syslog_facility" json:"syslog_facility"` // Version information is set at compilation time Revision string Version string VersionPrerelease string // List of config files that have been loaded (in order) Files []string `mapstructure:"-"` // HTTPAPIResponseHeaders allows users to configure the http agent to // set arbitrary headers on API responses HTTPAPIResponseHeaders map[string]string `mapstructure:"http_api_response_headers" json:"http_api_response_headers"` }
MayaConfig is the configuration for Maya server.
func DefaultMayaConfig ¶
func DefaultMayaConfig() *MayaConfig
DefaultMayaConfig is a the baseline configuration for Maya server
func LoadMayaConfig ¶
func LoadMayaConfig(path string) (*MayaConfig, error)
LoadMayaConfig loads the configuration at the given path, regardless if its a file or directory.
func LoadMayaConfigDir ¶
func LoadMayaConfigDir(dir string) (*MayaConfig, error)
LoadMayaConfigDir loads all the configurations in the given directory in alphabetical order.
func ParseMayaConfig ¶
func ParseMayaConfig(r io.Reader) (*MayaConfig, error)
ParseMayaConfig parses the config from the given io.Reader.
Due to current internal limitations, the entire contents of io.Reader will be copied into memory first before parsing.
func ParseMayaConfigFile ¶
func ParseMayaConfigFile(path string) (*MayaConfig, error)
ParseMayaConfigFile parses the given path as maya config
func (*MayaConfig) GoString ¶
func (c *MayaConfig) GoString() string
GoString implements GoStringer interface
func (*MayaConfig) Listener ¶
Listener can be used to get a new listener using a custom bind address. If the bind provided address is empty, the BindAddr is used instead.
func (*MayaConfig) Merge ¶
func (mc *MayaConfig) Merge(b *MayaConfig) *MayaConfig
Merge merges two configurations & returns a new one.
func (*MayaConfig) NormalizeAddrs ¶
func (mc *MayaConfig) NormalizeAddrs() error
NormalizeAddrs normalizes Addresses and AdvertiseAddrs to always be initialized and have sane defaults.
func (*MayaConfig) String ¶
func (c *MayaConfig) String() string
String implements Stringer interface