config

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &Config{
	ListenerValue: []string{":9999"},
	Proxy: Proxy{
		MaxConn:       10000,
		Strategy:      "rnd",
		Matcher:       "prefix",
		NoRouteStatus: 404,
		DialTimeout:   30 * time.Second,
		FlushInterval: time.Second,
		LocalIP:       LocalIPString(),
	},
	Registry: Registry{
		Backend: "consul",
		Consul: Consul{
			Addr:          "localhost:8500",
			Scheme:        "http",
			KVPath:        "/fabio/config",
			TagPrefix:     "urlprefix-",
			Register:      true,
			ServiceAddr:   ":9998",
			ServiceName:   "fabio",
			ServiceStatus: []string{"passing"},
			CheckInterval: time.Second,
			CheckTimeout:  3 * time.Second,
		},
	},
	Runtime: Runtime{
		GOGC:       800,
		GOMAXPROCS: runtime.NumCPU(),
	},
	UI: UI{
		Addr:  ":9998",
		Color: "light-green",
	},
	Metrics: Metrics{
		Prefix:         "{{clean .Hostname}}.{{clean .Exec}}",
		Names:          "{{clean .Service}}.{{clean .Host}}.{{clean .Path}}.{{clean .TargetURL.Host}}",
		Interval:       30 * time.Second,
		CirconusAPIApp: "fabio",
	},
	CertSources: map[string]CertSource{},
}

Functions

func LocalIP added in v1.0.6

func LocalIP() (net.IP, error)

LocalIP tries to determine a non-loopback address for the local machine

func LocalIPString added in v1.0.6

func LocalIPString() string

Types

type CertSource added in v1.2.1

type CertSource struct {
	Name         string
	Type         string
	CertPath     string
	KeyPath      string
	ClientCAPath string
	CAUpgradeCN  string
	Refresh      time.Duration
	Header       http.Header
}

type Config

type Config struct {
	Proxy       Proxy
	Registry    Registry
	Listen      []Listen
	CertSources map[string]CertSource
	Metrics     Metrics
	UI          UI
	Runtime     Runtime

	ListenerValue    []string
	CertSourcesValue []map[string]string
}

func Load added in v1.1.1

func Load() (cfg *Config, err error)

type Consul

type Consul struct {
	Addr          string
	Scheme        string
	Token         string
	KVPath        string
	TagPrefix     string
	Register      bool
	ServiceAddr   string
	ServiceName   string
	ServiceTags   []string
	ServiceStatus []string
	CheckInterval time.Duration
	CheckTimeout  time.Duration
}

type File added in v1.1.1

type File struct {
	Path string
}

type FlagSet added in v1.2.1

type FlagSet struct {
	flag.FlagSet
	// contains filtered or unexported fields
}

-- FlagSet

func NewFlagSet added in v1.2.1

func NewFlagSet(name string, errorHandling flag.ErrorHandling) *FlagSet

func (*FlagSet) IsSet added in v1.2.1

func (f *FlagSet) IsSet(name string) bool

IsSet returns true if a variable was set via any mechanism.

func (*FlagSet) KVSliceVar added in v1.2.1

func (f *FlagSet) KVSliceVar(p *[]map[string]string, name string, value []map[string]string, usage string)

func (*FlagSet) KVVar added in v1.2.1

func (f *FlagSet) KVVar(p *map[string]string, name string, value map[string]string, usage string)

func (*FlagSet) ParseFlags added in v1.2.1

func (f *FlagSet) ParseFlags(args, environ, prefixes []string, p *properties.Properties) error

ParseFlags parses command line arguments and provides fallback values from environment variables and config file values. Environment variables are case-insensitive and can have either of the provided prefixes.

func (*FlagSet) StringSliceVar added in v1.2.1

func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string)

type Listen

type Listen struct {
	Addr         string
	Proto        string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	CertSource   CertSource
	StrictMatch  bool
}

type Metrics

type Metrics struct {
	Target           string
	Prefix           string
	Names            string
	Interval         time.Duration
	GraphiteAddr     string
	StatsDAddr       string
	CirconusAPIKey   string
	CirconusAPIApp   string
	CirconusAPIURL   string
	CirconusCheckID  string
	CirconusBrokerID string
}

type Proxy

type Proxy struct {
	Strategy              string
	Matcher               string
	NoRouteStatus         int
	MaxConn               int
	ShutdownWait          time.Duration
	DialTimeout           time.Duration
	ResponseHeaderTimeout time.Duration
	KeepAliveTimeout      time.Duration
	ReadTimeout           time.Duration
	WriteTimeout          time.Duration
	FlushInterval         time.Duration
	LocalIP               string
	ClientIPHeader        string
	TLSHeader             string
	TLSHeaderValue        string
	GZIPContentTypesValue string
	GZIPContentTypes      *regexp.Regexp
}

type Registry added in v1.1.1

type Registry struct {
	Backend string
	Static  Static
	File    File
	Consul  Consul
}

type Runtime

type Runtime struct {
	GOGC       int
	GOMAXPROCS int
}

type Static added in v1.1.1

type Static struct {
	Routes string
}

type UI

type UI struct {
	Addr  string
	Color string
	Title string
}

Jump to

Keyboard shortcuts

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