config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Web: webOptions{
		ListenAddress: "0.0.0.0:9201",
		TelemetryPath: "/metrics",
	},
	Read: readOptions{
		Timeout:     5 * time.Minute,
		Delay:       1 * time.Hour,
		IgnoreError: true,
	},
	Write: writeOptions{
		Timeout: 5 * time.Minute,
	},
	Graphite: graphite.DefaultConfig,
}

DefaultConfig is the default top-level configuration.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigFile string
	LogLevel   promlog.AllowedLevel
	Web        webOptions      `yaml:"web,omitempty" json:"web,omitempty"`
	Read       readOptions     `yaml:"read,omitempty" json:"read,omitempty"`
	Write      writeOptions    `yaml:"write,omitempty" json:"write,omitempty"`
	Graphite   graphite.Config `yaml:"graphite,omitempty" json:"graphite,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline" json:"-"`
	// contains filtered or unexported fields
}

Config is the top-level configuration.

func Load

func Load(s string) (*Config, error)

Load parses the YAML input s into a Config.

func LoadFile

func LoadFile(logger log.Logger, filename string) (*Config, error)

LoadFile parses the given YAML file into a Config.

func ParseCommandLine

func ParseCommandLine() *Config

ParseCommandLine parse flags and args from cli.

func (Config) String

func (c Config) String() string

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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