config

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigurationFilePath is the default path that will be used to search for the configuration file
	// if a custom path isn't configured through the GATUS_CONFIG_FILE environment variable
	DefaultConfigurationFilePath = "config/config.yaml"

	// DefaultFallbackConfigurationFilePath is the default fallback path that will be used to search for the
	// configuration file if DefaultConfigurationFilePath didn't work
	DefaultFallbackConfigurationFilePath = "config/config.yml"

	// DefaultAddress is the default address the service will bind to
	DefaultAddress = "0.0.0.0"

	// DefaultPort is the default port the service will listen on
	DefaultPort = 8080

	// DefaultContextRoot is the default context root of the web application
	DefaultContextRoot = "/"
)

Variables

View Source
var (
	// ErrNoServiceInConfig is an error returned when a configuration file has no services configured
	ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")

	// ErrConfigFileNotFound is an error returned when the configuration file could not be found
	ErrConfigFileNotFound = errors.New("configuration file not found")

	// ErrConfigNotLoaded is an error returned when an attempt to Get() the configuration before loading it is made
	ErrConfigNotLoaded = errors.New("configuration is nil")

	// ErrInvalidSecurityConfig is an error returned when the security configuration is invalid
	ErrInvalidSecurityConfig = errors.New("invalid security configuration")
)

Functions

func GetAlertingProviderByAlertType added in v1.0.1

func GetAlertingProviderByAlertType(config *Config, alertType core.AlertType) provider.AlertProvider

GetAlertingProviderByAlertType returns an provider.AlertProvider by its corresponding core.AlertType

func Load

func Load(configFile string) error

Load loads a custom configuration file Note that the misconfiguration of some fields may lead to panics. This is on purpose.

func LoadDefaultConfiguration

func LoadDefaultConfiguration() error

LoadDefaultConfiguration loads the default configuration file

func Set added in v1.11.2

func Set(cfg *Config)

Set sets the configuration Used only for testing

Types

type Config

type Config struct {
	// Debug Whether to enable debug logs
	Debug bool `yaml:"debug"`

	// Metrics Whether to expose metrics at /metrics
	Metrics bool `yaml:"metrics"`

	// DisableMonitoringLock Whether to disable the monitoring lock
	// The monitoring lock is what prevents multiple services from being processed at the same time.
	// Disabling this may lead to inaccurate response times
	DisableMonitoringLock bool `yaml:"disable-monitoring-lock"`

	// Security Configuration for securing access to Gatus
	Security *security.Config `yaml:"security"`

	// Alerting Configuration for alerting
	Alerting *alerting.Config `yaml:"alerting"`

	// Services List of services to monitor
	Services []*core.Service `yaml:"services"`

	// Kubernetes is the Kubernetes configuration
	Kubernetes *k8s.Config `yaml:"kubernetes"`

	// Web is the configuration for the web listener
	Web *webConfig `yaml:"web"`
}

Config is the main configuration structure

func Get

func Get() *Config

Get returns the configuration, or panics if the configuration hasn't loaded yet

Jump to

Keyboard shortcuts

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