config

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskEnvValue added in v0.9.0

func MaskEnvValue(s string) string

MaskEnvValue return masked env value ex) FOOBARBAZ -> FOOB***

Types

type CheckPlugin

type CheckPlugin struct {
	Name    string
	Command cmdutil.Command
	User    string
	Env     Env
	Timeout time.Duration
	Memo    string
}

CheckPlugin represents check plugin

type Config

type Config struct {
	Apibase           string        `yaml:"apibase"`
	Apikey            string        `yaml:"apikey"`
	Root              string        `yaml:"root"`
	Roles             []string      `yaml:"roles"`
	DisplayName       string        `yaml:"displayName"`
	Memo              string        `yaml:"memo"`
	IgnoreContainer   Regexpwrapper `yaml:"ignoreContainer"`
	ReadinessProbe    *Probe        `yaml:"readinessProbe"`
	HostStatusOnStart HostStatus    `yaml:"hostStatusOnStart"`
	MetricPlugins     []*MetricPlugin
	CheckPlugins      []*CheckPlugin
}

Config represents agent configuration

type Env

type Env []string

Env represents environment variables

func (*Env) UnmarshalYAML

func (env *Env) UnmarshalYAML(unmarshal func(v any) error) (err error)

UnmarshalYAML defines unmarshaler from YAML

type Header struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

Header is a request header for http probe.

type HostStatus

type HostStatus string

HostStatus represents host status

func (*HostStatus) UnmarshalText

func (s *HostStatus) UnmarshalText(text []byte) error

UnmarshalText decodes host status string

type Loader added in v0.2.0

type Loader struct {
	// contains filtered or unexported fields
}

Loader represents a config loader

func NewLoader added in v0.2.0

func NewLoader(location string, pollingDuration time.Duration) *Loader

NewLoader creates a new Loader

func (*Loader) Load added in v0.2.0

func (l *Loader) Load(ctx context.Context) (*Config, error)

Load agent configuration

func (*Loader) Start added in v0.2.0

func (l *Loader) Start(ctx context.Context) <-chan struct{}

Start the loader loop

type MetricPlugin

type MetricPlugin struct {
	Name    string
	Command cmdutil.Command
	User    string
	Env     Env
	Timeout time.Duration
}

MetricPlugin represents metric plugin

type Probe

type Probe struct {
	Exec                *ProbeExec `yaml:"exec"`
	HTTP                *ProbeHTTP `yaml:"http"`
	TCP                 *ProbeTCP  `yaml:"tcp"`
	InitialDelaySeconds int        `yaml:"initialDelaySeconds"`
	PeriodSeconds       int        `yaml:"periodSeconds"`
	TimeoutSeconds      int        `yaml:"timeoutSeconds"`
}

Probe configuration.

type ProbeExec

type ProbeExec struct {
	Command cmdutil.Command `yaml:"command"`
	User    string          `yaml:"user"`
	Env     Env             `yaml:"env"`
}

ProbeExec is a probe with command.

type ProbeHTTP

type ProbeHTTP struct {
	Scheme    string   `yaml:"scheme"`
	Method    string   `yaml:"method"`
	Host      string   `yaml:"host"`
	Port      string   `yaml:"port"`
	Path      string   `yaml:"path"`
	Headers   []Header `yaml:"headers"`
	UserAgent string
	Proxy     URLWrapper `yaml:"proxy"`
}

ProbeHTTP is a probe with http.

type ProbeTCP

type ProbeTCP struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

ProbeTCP is a probe with tcp.

type Regexpwrapper

type Regexpwrapper struct {
	*regexp.Regexp
}

Regexpwrapper wraps regexp.Regexp

func (*Regexpwrapper) UnmarshalText

func (r *Regexpwrapper) UnmarshalText(text []byte) error

UnmarshalText decodes regexp string

type URLWrapper added in v0.0.5

type URLWrapper struct {
	*url.URL
}

URLWrapper wraps url.URL

func (*URLWrapper) UnmarshalText added in v0.0.5

func (u *URLWrapper) UnmarshalText(text []byte) error

UnmarshalText decodes host status string

Jump to

Keyboard shortcuts

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