config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(config *Config, filename string) error

LoadConfigFromFile fills a configuration object (passed as parameter) with values read from a configuration file (pass as parameter by filename). The configuration file needs to be in HCL format.

func LoadConfigFromFlags

func LoadConfigFromFlags(config *Config, flags *StartupFlags) error

LoadConfigFromFlags fills a configuration object (passed as parameter) with values from command-line flags.

Types

type Config

type Config struct {
	Listen     ListenConfig
	Consul     ConsulConfig
	Namespaces []NamespaceConfig `hcl:"namespace"`
}

Config models the application's configuration

type ConsulConfig

type ConsulConfig struct {
	Enable     bool
	Address    string
	Datacenter string
	Scheme     string
	Token      string
	Service    ConsulServiceConfig
}

type ConsulServiceConfig

type ConsulServiceConfig struct {
	ID   string
	Name string
	Tags []string
}

type ListenConfig

type ListenConfig struct {
	Port    int
	Address string
}

ListenConfig is a struct describing the built-in webserver configuration

type NamespaceConfig

type NamespaceConfig struct {
	Name        string            `hcl:",key"`
	SourceFiles []string          `hcl:"source_files"`
	Format      string            `hcl:"format"`
	Labels      map[string]string `hcl:"labels"`
}

NamespaceConfig is a struct describing single metric namespaces

func (*NamespaceConfig) LabelNames

func (c *NamespaceConfig) LabelNames() []string

LabelNames exports the names of all known additional labels

func (*NamespaceConfig) LabelValues

func (c *NamespaceConfig) LabelValues() []string

LabelValues exports the values of all known additional labels

type StartupFlags

type StartupFlags struct {
	ConfigFile string
	Filenames  []string
	Format     string
	Namespace  string
	ListenPort int
}

StartupFlags is a struct containing options that can be passed via the command line

Jump to

Keyboard shortcuts

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