config

package
v0.0.2-untested Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentSetAuthToken

func AgentSetAuthToken(args ...any) error

AgentSetAuthToken sets the auth token in the agent config

func AgentSetMachineName

func AgentSetMachineName(args ...any) error

AgentSetMachineName sets the machine name in the agent config

func AgentSetServerAddress

func AgentSetServerAddress(args ...any) error

AgentSetServerAddress sets the server address in the agent config

func BindFlags

func BindFlags(flagSet *pflag.FlagSet)

BindFlags binds the flags to the viper configuration This is needed because viper doesn't support same flag name accross multiple commands Details here: https://github.com/spf13/viper/issues/375#issuecomment-794668149

func CraftAgentConfig

func CraftAgentConfig() error

CraftAgentConfig parse file>env>flag for agent configuration then loads it into Agent variable Flags defaults set defaults for the agent configuration

func CraftServerConfig

func CraftServerConfig() error

CraftServerConfig parse file>env>flag for server configuration then loads it into Server variable Flags defaults set defaults for the server configuration

func PrintAgentConfig

func PrintAgentConfig(refresh ...bool)

func PrintServerConfig

func PrintServerConfig()

PrintServerConfig prints the server configuration

func RefreshAgentConfig

func RefreshAgentConfig()

func SetLogging

func SetLogging()

SetLogging sets the logging level and format

Types

type AgentConfig

type AgentConfig struct {
	sync.Mutex
	ServerAddress string `mapstructure:"server-address"`
	MachineName   string `mapstructure:"machine-name"`
	LoggingLevel  string `mapstructure:"logging-level"`
	AuthToken     string `mapstructure:"auth-token"`
	MachineState  bool   `mapstructure:"machine-state"`
}

AgentConfig is the configuration for the agent

var Agent *AgentConfig

Agent is the configuration for the agent

type AlertProviderConfig

type AlertProviderConfig interface {
	Type() AlertProviderType
}

AlertProviderConfig is the interface for alert providers

type AlertProviderType

type AlertProviderType int

AlertProviderType is an iota type for different alert provider types

const (
	EmptyProviderType AlertProviderType
)

func (AlertProviderType) String

func (a AlertProviderType) String() string

type EmptyProvider

type EmptyProvider struct{}

func (*EmptyProvider) Type

func (k *EmptyProvider) Type() AlertProviderType

type KeepHQConfig

type KeepHQConfig struct {
}

func (*KeepHQConfig) Type

func (k *KeepHQConfig) Type() AlertProviderType

type PagerDutyConfig

type PagerDutyConfig struct {
	APIKey         string `json:"api_key"`
	IntegrationKey string `json:"integration_key"`
	IntegrationURL string `json:"integration_url"`
}

func (*PagerDutyConfig) Type

type ServerConfig

type ServerConfig struct {
	ListeningAddress                 string `mapstructure:"address"`
	Port                             int    `mapstructure:"port"`
	AuthToken                        string `mapstructure:"auth-token"`
	ProbeInactivityDelay             string `mapstructure:"probe-inactivity-delay"`
	DegradedToFailedThreshold        int    `mapstructure:"degraded-to-failed"`
	FailedToAlertedLowThreshold      int    `mapstructure:"failed-to-alertLow"`
	AlertedLowToAlertedHighThreshold int    `mapstructure:"alertLow-to-alertHigh"`
	LoggingLevel                     string `mapstructure:"logging-level"`
	LowAlertProvider                 AlertProviderConfig
	HighAlertProvider                AlertProviderConfig
}

ServerConfig is the configuration for the server

var Server *ServerConfig

Server is the configuration for the server

type ServiceConfig

type ServiceConfig struct {
	ServiceName string `json:"service_name"`
}

ServiceConfig is the configuration for the service

Jump to

Keyboard shortcuts

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