config

package
v0.0.0-...-38846bf Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 6 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 {
	Listen ListenConfig `hcl:"listen"`
	Sites  []SiteConfig `hcl:"site"`
	Metric MetricConfig `hcl:"metric"`
	Logger LoggerConfig `hcl:"logger"`
	Consul ConsulConfig `hcl:"consul"`
}

Config models the application's configuration

func LoadConfig

func LoadConfig() (*Config, error)

type ConsulConfig

type ConsulConfig struct {
	Enable                  bool   `hcl:"enable"`
	Name                    string `hcl:"name"`
	Address                 string `hcl:"address"`
	DeregisterOnServiceStop bool   `hcl:"deregister_on_service_stop"`
}

type LabelConfig

type LabelConfig struct {
	Name       string       `hcl:"label_name"`
	Source     string       `hcl:"source"`
	FixedValue string       `hcl:"fixed_value"`
	Rules      []RuleConfig `hcl:"rules"`
}

type ListenConfig

type ListenConfig struct {
	Port    int
	Address string
}

ListenConfig is a struct describing the built-in webserver configuration

type LoggerConfig

type LoggerConfig struct {
	OutputDir     string `hcl:"output_log_dir"`
	RotateEveryMb int    `hcl:"rotate_every_mb"`
	FilesNumber   int    `hcl:"number_of_files"`
	MaxAge        int    `hcl:"files_max_age"`
}

type MetricConfig

type MetricConfig struct {
	MetricPrefix string   `hcl:"metric_prefix"`
	Labels       []string `hcl:"labels"`
}

type RuleConfig

type RuleConfig struct {
	Pattern    string `hcl:"pattern"`
	LabelValue string `hcl:"label_value"`
}

type SiteConfig

type SiteConfig struct {
	Name       string        `hcl:",key"`
	LogsDir    string        `hcl:"logs_dir"`
	Pattern    string        `hcl:"pattern"`
	LabelRules []LabelConfig `hcl:"label_rules"`
}

type StartupFlags

type StartupFlags struct {
	ConfigFile string
}

StartupFlags is a struct containing filename option 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