config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFile embed.FS
View Source
var ConfigFileFlag *string

ConfigFile is the flag used to load the config file

View Source
var InitConfigFlag = flag.String("init-config", "", "Initialize configuration file")

InitConfigFlag is the flag used to initialize the config file

Functions

func WriteDefaultConfigFile added in v1.3.0

func WriteDefaultConfigFile(filename string) error

WriteDefaultConfigFile write default configuration file

Types

type Config

type Config struct {
	Log      LogConfig
	HTTP     HTTPConfig
	GeoIP    GeoIPConfig `toml:"geo-ip"`
	Global   GlobalConfig
	Trackers []TrackerConfig
	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) *TrackerConfig

GetTracker retrive tracker configuration

func (*Config) LoadConfigFromfile added in v1.3.0

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

LoadConfigFromFile 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 GeoIPConfig added in v1.3.0

type GeoIPConfig struct {
	Database string
}

GeoIPConfig for GeoIP configuration section

type GlobalConfig

type GlobalConfig struct {
	Tags map[string]string
}

GlobalConfig for global configuration section

type HTTPConfig added in v1.3.0

type HTTPConfig struct {
	ListenAddr string
}

HTTPConfig for HTTP configuration section

type LogConfig added in v1.3.0

type LogConfig struct {
	Level   string
	Format  string
	Modules string
}

LogConfig for log configuration section

type TrackerConfig added in v1.3.0

type TrackerConfig struct {
	Origin       string
	TrackingID   string `toml:"tracking_id"`
	Badge        string
	RateLimiting map[string]interface{}
	RateLimiter  usage.RateLimiter
}

TrackerConfig for tracker configurtion section

Jump to

Keyboard shortcuts

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