Documentation ¶
Index ¶
- func AgentSetAuthToken(args ...any) error
- func AgentSetMachineName(args ...any) error
- func AgentSetServerAddress(args ...any) error
- func BindFlags(flagSet *pflag.FlagSet)
- func CraftAgentConfig() error
- func CraftServerConfig() error
- func PrintAgentConfig(refresh ...bool)
- func PrintServerConfig()
- func RefreshAgentConfig()
- func SetLogging()
- type AgentConfig
- type AlertProviderConfig
- type AlertProviderType
- type EmptyProvider
- type KeepHQConfig
- type PagerDutyConfig
- type ServerConfig
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentSetAuthToken ¶
AgentSetAuthToken sets the auth token in the agent config
func AgentSetMachineName ¶
AgentSetMachineName sets the machine name in the agent config
func AgentSetServerAddress ¶
AgentSetServerAddress sets the server address in the agent config
func BindFlags ¶
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 RefreshAgentConfig ¶
func RefreshAgentConfig()
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 ¶
func (p *PagerDutyConfig) Type() AlertProviderType
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