Documentation ¶
Index ¶
- Variables
- func Validate(validators []ValidatorFunc) error
- type Config
- type Controller
- type Endpoint
- type Registry
- type Service
- type ValidatorFunc
- func IsInRange(name string, value, min, max int) ValidatorFunc
- func IsInRangeDuration(name string, value, min, max time.Duration) ValidatorFunc
- func IsInSet(name, value string, set []string) ValidatorFunc
- func IsNotEmpty(name, value string) ValidatorFunc
- func IsValidURL(name, value string) ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Register: false, Proxy: false, Service: Service{ Name: "", Tags: nil, }, Endpoint: Endpoint{ Host: "", Port: 0, Type: "http", }, Registry: Registry{ URL: "", Token: "", Poll: time.Duration(15 * time.Second), }, Controller: Controller{ URL: "", Token: "", Poll: time.Duration(15 * time.Second), }, Supervise: false, App: nil, Log: false, LogstashServer: "", LogLevel: "info", }
DefaultConfig defines default values for the various configuration options
View Source
var Flags = []cli.Flag{ cli.StringFlag{ Name: configFlag, EnvVar: envVar(configFlag), Usage: "Load configuration from file", }, cli.BoolFlag{ Name: registerFlag, EnvVar: envVar(registerFlag), Usage: "Enable automatic service registration and heartbeat", }, cli.BoolFlag{ Name: proxyFlag, EnvVar: envVar(proxyFlag), Usage: "Enable automatic service discovery and load balancing across services using NGINX", }, cli.StringFlag{ Name: serviceFlag, EnvVar: envVar(serviceFlag), Usage: "Service name to register with", }, cli.StringFlag{ Name: endpointHostFlag, EnvVar: envVar(endpointHostFlag), Usage: "Service endpoint host name (local IP is used if none specified)", }, cli.IntFlag{ Name: endpointPortFlag, EnvVar: envVar(endpointPortFlag), Usage: "Service endpoint port", }, cli.StringFlag{ Name: endpointTypeFlag, EnvVar: envVar(endpointTypeFlag), Usage: "Service endpoint type (http, https, tcp, udp, user)", }, cli.StringFlag{ Name: registryURLFlag, EnvVar: envVar(registryURLFlag), Usage: "URL for Registry", }, cli.StringFlag{ Name: registryTokenFlag, EnvVar: envVar(registryTokenFlag), Usage: "API token for Registry", }, cli.DurationFlag{ Name: registryPollFlag, EnvVar: envVar(registryPollFlag), Usage: "Interval for polling Controller", }, cli.StringFlag{ Name: controllerURLFlag, EnvVar: envVar(controllerURLFlag), Usage: "URL for Controller service", }, cli.StringFlag{ Name: controllerTokenFlag, EnvVar: envVar(controllerTokenFlag), Usage: "Amalgam8 controller token", }, cli.DurationFlag{ Name: controllerPollFlag, EnvVar: envVar(controllerPollFlag), Usage: "Interval for polling Controller", }, cli.BoolFlag{ Name: superviseFlag, EnvVar: envVar(superviseFlag), Usage: "Enable monitoring of application process. If application dies, container is killed as well. This has to be the last flag. All arguments provided after this flag will considered as part of the application invocation", }, cli.BoolFlag{ Name: logFlag, EnvVar: envVar(logFlag), Usage: "Enable logging of outgoing requests through proxy using FileBeat", }, cli.StringFlag{ Name: logstashServerFlag, EnvVar: envVar(logstashServerFlag), Usage: "Logstash target for nginx logs", }, cli.StringFlag{ Name: logLevelFlag, EnvVar: envVar(logLevelFlag), Usage: "Logging level (debug, info, warn, error, fatal, panic)", }, }
Flags is the set of supported flags
Functions ¶
Types ¶
type Config ¶
type Config struct { Register bool `yaml:"register"` Proxy bool `yaml:"proxy"` Service Service `yaml:"service"` Endpoint Endpoint `yaml:"endpoint"` Registry Registry `yaml:"registry"` Controller Controller `yaml:"controller"` Supervise bool `yaml:"supervise"` App []string `yaml:"app"` Log bool `yaml:"log"` LogstashServer string `yaml:"logstash_server"` LogLevel string `yaml:"log_level"` }
Config stores the various configuration options for the sidecar
type Controller ¶
type Controller struct { URL string `yaml:"url"` Token string `yaml:"token"` Poll time.Duration `yaml:"poll"` }
Controller configuration
type Registry ¶
type Registry struct { URL string `yaml:"url"` Token string `yaml:"token"` Poll time.Duration `yaml:"poll"` }
Registry configuration
type ValidatorFunc ¶
type ValidatorFunc func() error
ValidatorFunc performs a validation check
func IsInRange ¶
func IsInRange(name string, value, min, max int) ValidatorFunc
IsInRange ensures the integer is within the specified inclusive range
func IsInRangeDuration ¶
func IsInRangeDuration(name string, value, min, max time.Duration) ValidatorFunc
IsInRangeDuration ensures the time value is between the given min and max times
func IsInSet ¶
func IsInSet(name, value string, set []string) ValidatorFunc
IsInSet ensures that the value is a member of the set
func IsNotEmpty ¶
func IsNotEmpty(name, value string) ValidatorFunc
IsNotEmpty ensures the value is not empty
func IsValidURL ¶
func IsValidURL(name, value string) ValidatorFunc
IsValidURL ensures that the URL is valid and has a protocol specified (http, https, etc...)
Click to show internal directories.
Click to hide internal directories.