config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Global   GlobalConfig
	Trackers []Tracker
	Outputs  []outputs.Output
}

Config is the root of the configuration

func NewConfig

func NewConfig() *Config

NewConfig create new configuration

func (*Config) GetTracker

func (c *Config) GetTracker(trackingID string) *Tracker

GetTracker retrive tracker configuration

func (*Config) LoadConfig

func (c *Config) LoadConfig(path string) error

LoadConfig loads the given config file and applies it to c

type Duration

type Duration struct {
	time.Duration
}

Duration custom configuration type

func (*Duration) UnmarshalTOML

func (d *Duration) UnmarshalTOML(data []byte) (err error)

UnmarshalTOML unmarshal TOML bytes to Duration

type Flags

type Flags struct {
	ListenAddr string `flag:"listen-addr" desc:"HTTP listen address" default:":8080"`
	ConfigFile string `flag:"config-file" desc:"Config file" default:"zero-analytics.toml"`
	Debug      bool   `flag:"debug" desc:"Output debug logs" default:"false"`
}

Flags contain global configuration

type GlobalConfig

type GlobalConfig struct {
	GeoIPDatabase string `toml:"geo_ip_database"`
	Tags          map[string]string
}

GlobalConfig is the global section fo the configuration

type Tracker

type Tracker struct {
	Origin     string
	TrackingID string `toml:"tracking_id"`
	Badge      string `toml:"badge"`
}

Tracker structure

Jump to

Keyboard shortcuts

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