mirror of
https://github.com/TwiN/gatus.git
synced 2025-02-17 18:51:15 +01:00
Improve code documentation
This commit is contained in:
parent
1bde98868e
commit
4e3856c638
@ -23,11 +23,19 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")
|
// ErrNoServiceInConfig is an error returned when a configuration file has no services configured
|
||||||
ErrConfigFileNotFound = errors.New("configuration file not found")
|
ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")
|
||||||
ErrConfigNotLoaded = errors.New("configuration is nil")
|
|
||||||
|
// 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")
|
ErrInvalidSecurityConfig = errors.New("invalid security configuration")
|
||||||
config *Config
|
|
||||||
|
config *Config
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the main configuration structure
|
// Config is the main configuration structure
|
||||||
@ -168,6 +176,7 @@ func validateAlertingConfig(config *Config) {
|
|||||||
log.Printf("[config][validateAlertingConfig] configuredProviders=%s; ignoredProviders=%s", validProviders, invalidProviders)
|
log.Printf("[config][validateAlertingConfig] configuredProviders=%s; ignoredProviders=%s", validProviders, invalidProviders)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAlertingProviderByAlertType returns an provider.AlertProvider by its corresponding core.AlertType
|
||||||
func GetAlertingProviderByAlertType(config *Config, alertType core.AlertType) provider.AlertProvider {
|
func GetAlertingProviderByAlertType(config *Config, alertType core.AlertType) provider.AlertProvider {
|
||||||
switch alertType {
|
switch alertType {
|
||||||
case core.SlackAlert:
|
case core.SlackAlert:
|
||||||
|
@ -4,8 +4,13 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HealthStatus is the status of Gatus
|
||||||
type HealthStatus struct {
|
type HealthStatus struct {
|
||||||
Status string `json:"status"`
|
// Status is the state of Gatus (UP/DOWN)
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Message is an accompanying description of why the status is as reported.
|
||||||
|
// If the Status is UP, no message will be provided
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +47,11 @@ type Result struct {
|
|||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConditionResult result of a Condition
|
||||||
type ConditionResult struct {
|
type ConditionResult struct {
|
||||||
|
// Condition that was evaluated
|
||||||
Condition string `json:"condition"`
|
Condition string `json:"condition"`
|
||||||
Success bool `json:"success"`
|
|
||||||
|
// Success whether the condition was met (successful) or not (failed)
|
||||||
|
Success bool `json:"success"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user