config

package
v0.0.0-...-9b981ae Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IncidentInvestigatingStatus Incident investigating status
	IncidentInvestigatingStatus = "INVESTIGATING"
	// IncidentIdentifiedStatus Incident identified status
	IncidentIdentifiedStatus = "IDENTIFIED"
	// IncidentWatchingStatus Incident watching status
	IncidentWatchingStatus = "WATCHING"
	// IncidentFixedStatus Incident fixed status
	IncidentFixedStatus = "FIXED"
)
View Source
const (
	// ComponentOperationalStatus Component operational status
	ComponentOperationalStatus = "OPERATIONAL"
	// ComponentPerformanceIssuesStatus Component performance issues status
	ComponentPerformanceIssuesStatus = "PERFORMANCE_ISSUES"
	// ComponentPartialOutageStatus Component partial outage status
	ComponentPartialOutageStatus = "PARTIAL_OUTAGE"
	// ComponentMajorOutageStatus Component major outage status
	ComponentMajorOutageStatus = "MAJOR_OUTAGE"
)
View Source
const DefaultInternalPort = 9090

DefaultInternalPort Default internal port

View Source
const DefaultLogFormat = "json"

DefaultLogFormat Default Log format

View Source
const DefaultLogLevel = "info"

DefaultLogLevel Default log level

View Source
const DefaultPort = 8080

DefaultPort Default port

View Source
const MainConfigPath = "conf/config.yaml"

MainConfigPath Configuration path

Variables

This section is empty.

Functions

func ConfigureLogger

func ConfigureLogger(logger *logrus.Logger, logConfig *LogConfig) error

ConfigureLogger Configure logger instance

Types

type CachetConfig

type CachetConfig struct {
	URL    string `koanf:"url" validate:"required,uri"`
	APIKey string `koanf:"apiKey" validate:"required"`
}

CachetConfig CachetHQ Configuration

type Config

type Config struct {
	Log            *LogConfig    `koanf:"log"`
	InternalServer *ServerConfig `koanf:"internalServer"`
	Server         *ServerConfig `koanf:"server"`
	Cachet         *CachetConfig `koanf:"cachet" validate:"required"`
	Targets        []*Target     `koanf:"targets" validate:"required,dive,required"`
}

Config Application Configuration

func Load

func Load() (*Config, error)

Load Load configuration

type LogConfig

type LogConfig struct {
	Level  string `koanf:"level"`
	Format string `koanf:"format"`
}

LogConfig Log configuration

type ServerConfig

type ServerConfig struct {
	ListenAddr string `koanf:"listenAddr"`
	Port       int    `koanf:"port" validate:"required"`
}

ServerConfig Server configuration

type Target

type Target struct {
	Component *TargetComponent `koanf:"component" validate:"required"`
	Alerts    []*TargetAlerts  `koanf:"alerts" validate:"required,dive,required"`
	Incident  *TargetIncident  `koanf:"incident" validate:"omitempty"`
}

Target Target configuration

type TargetAlerts

type TargetAlerts struct {
	Name   string            `koanf:"name" validate:"required_without_all=Labels"`
	Labels map[string]string `koanf:"labels" validate:"required_without_all=Name"`
}

TargetAlerts Target Prometheus alerts

type TargetComponent

type TargetComponent struct {
	Name      string `koanf:"name" validate:"required"`
	GroupName string `koanf:"groupName"`
	Status    string `koanf:"status" validate:"required,oneof=OPERATIONAL PERFORMANCE_ISSUES PARTIAL_OUTAGE MAJOR_OUTAGE"`
}

TargetComponent Target component

type TargetIncident

type TargetIncident struct {
	Name    string `koanf:"name" validate:"required"`
	Content string `koanf:"content" validate:"required"`
	Status  string `koanf:"status" validate:"required,oneof=INVESTIGATING IDENTIFIED WATCHING FIXED"`
	Public  bool   `koanf:"public"`
}

TargetIncident incident

Jump to

Keyboard shortcuts

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