Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateAlertingConfig(alertingConfig *alerting.Config, endpoints []*endpoint.Endpoint, ...)
- func ValidateAndSetConcurrencyDefaults(config *Config)
- func ValidateAnnouncementsConfig(config *Config) error
- func ValidateConnectivityConfig(config *Config) error
- func ValidateEndpointsConfig(config *Config) error
- func ValidateMaintenanceConfig(config *Config) error
- func ValidateRemoteConfig(config *Config) error
- func ValidateSecurityConfig(config *Config) error
- func ValidateStorageConfig(config *Config) error
- func ValidateSuitesConfig(config *Config) error
- func ValidateTunnelingConfig(config *Config) error
- func ValidateUIConfig(config *Config) error
- func ValidateUniqueKeys(config *Config) error
- func ValidateWebConfig(config *Config) error
- type Config
- func (config *Config) GetEndpointByKey(key string) *endpoint.Endpoint
- func (config *Config) GetExternalEndpointByKey(key string) *endpoint.ExternalEndpoint
- func (config *Config) GetUniqueExtraMetricLabels() []string
- func (config *Config) HasLoadedConfigurationBeenModified() bool
- func (config *Config) UpdateLastFileModTime()
Constants ¶
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_PATH 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" // DefaultConcurrency is the default number of endpoints/suites that can be monitored concurrently DefaultConcurrency = 3 )
Variables ¶
var ( // ErrNoEndpointOrSuiteInConfig is an error returned when a configuration file or directory has no endpoints configured ErrNoEndpointOrSuiteInConfig = errors.New("configuration should contain at least one endpoint or suite") // ErrConfigFileNotFound is an error returned when a configuration file could not be found ErrConfigFileNotFound = errors.New("configuration file not found") // ErrInvalidSecurityConfig is an error returned when the security configuration is invalid ErrInvalidSecurityConfig = errors.New("invalid security configuration") )
Functions ¶
func ValidateAlertingConfig ¶
func ValidateAlertingConfig(alertingConfig *alerting.Config, endpoints []*endpoint.Endpoint, externalEndpoints []*endpoint.ExternalEndpoint)
ValidateAlertingConfig validates the alerting configuration Note that the alerting configuration has to be validated before the endpoint configuration, because the default alert returned by provider.AlertProvider.GetDefaultAlert() must be parsed before endpoint.Endpoint.ValidateAndSetDefaults() sets the default alert values when none are set.
func ValidateAndSetConcurrencyDefaults ¶
func ValidateAndSetConcurrencyDefaults(config *Config)
func ValidateEndpointsConfig ¶
func ValidateRemoteConfig ¶
func ValidateSecurityConfig ¶
func ValidateStorageConfig ¶
func ValidateSuitesConfig ¶
func ValidateTunnelingConfig ¶
ValidateTunnelingConfig validates the tunneling configuration and resolves tunnel references NOTE: This must be called after ValidateEndpointsConfig and ValidateSuitesConfig because it resolves tunnel references in endpoint and suite client configurations
func ValidateUIConfig ¶
func ValidateUniqueKeys ¶
func ValidateWebConfig ¶
Types ¶
type Config ¶
type Config struct {
// Debug Whether to enable debug logs
// Deprecated: Use the GATUS_LOG_LEVEL environment variable instead
Debug bool `yaml:"debug,omitempty"`
// Metrics Whether to expose metrics at /metrics
Metrics bool `yaml:"metrics,omitempty"`
// SkipInvalidConfigUpdate Whether to make the application ignore invalid configuration
// if the configuration file is updated while the application is running
SkipInvalidConfigUpdate bool `yaml:"skip-invalid-config-update,omitempty"`
// DisableMonitoringLock Whether to disable the monitoring lock
// The monitoring lock is what prevents multiple endpoints from being processed at the same time.
// Disabling this may lead to inaccurate response times
//
// Deprecated: Use Concurrency instead TODO: REMOVE THIS IN v6.0.0
DisableMonitoringLock bool `yaml:"disable-monitoring-lock,omitempty"`
// Concurrency is the maximum number of endpoints/suites that can be monitored concurrently
// Defaults to DefaultConcurrency. Set to 0 for unlimited concurrency.
Concurrency int `yaml:"concurrency,omitempty"`
// Security is the configuration for securing access to Gatus
Security *security.Config `yaml:"security,omitempty"`
// Alerting is the configuration for alerting providers
Alerting *alerting.Config `yaml:"alerting,omitempty"`
// Endpoints is the list of endpoints to monitor
Endpoints []*endpoint.Endpoint `yaml:"endpoints,omitempty"`
// ExternalEndpoints is the list of all external endpoints
ExternalEndpoints []*endpoint.ExternalEndpoint `yaml:"external-endpoints,omitempty"`
// Suites is the list of suites to monitor
Suites []*suite.Suite `yaml:"suites,omitempty"`
// Storage is the configuration for how the data is stored
Storage *storage.Config `yaml:"storage,omitempty"`
// Web is the web configuration for the application
Web *web.Config `yaml:"web,omitempty"`
// UI is the configuration for the UI
UI *ui.Config `yaml:"ui,omitempty"`
// Maintenance is the configuration for creating a maintenance window in which no alerts are sent
Maintenance *maintenance.Config `yaml:"maintenance,omitempty"`
// Remote is the configuration for remote Gatus instances
// WARNING: This is in ALPHA and may change or be completely removed in the future
Remote *remote.Config `yaml:"remote,omitempty"`
// Connectivity is the configuration for connectivity
Connectivity *connectivity.Config `yaml:"connectivity,omitempty"`
// Tunneling is the configuration for SSH tunneling
Tunneling *tunneling.Config `yaml:"tunneling,omitempty"`
// Announcements is the list of system-wide announcements
Announcements []*announcement.Announcement `yaml:"announcements,omitempty"`
// contains filtered or unexported fields
}
Config is the main configuration structure
func LoadConfiguration ¶
LoadConfiguration loads the full configuration composed of the main configuration file and all composed configuration files
func (*Config) GetEndpointByKey ¶
func (*Config) GetExternalEndpointByKey ¶
func (config *Config) GetExternalEndpointByKey(key string) *endpoint.ExternalEndpoint
func (*Config) GetUniqueExtraMetricLabels ¶
GetUniqueExtraMetricLabels returns a slice of unique metric labels from all enabled endpoints in the configuration. It iterates through each endpoint, checks if it is enabled, and then collects unique labels from the endpoint's labels map.
func (*Config) HasLoadedConfigurationBeenModified ¶
HasLoadedConfigurationBeenModified returns whether one of the file that the configuration has been loaded from has been modified since it was last read
func (*Config) UpdateLastFileModTime ¶
func (config *Config) UpdateLastFileModTime()
UpdateLastFileModTime refreshes Config.lastFileModTime