1
0
mirror of https://github.com/TwiN/gatus.git synced 2026-02-15 10:20:05 +00:00

fix: Don't panic on if there's 0 endpoints and >1 suite + update documentation (#1266)

This commit is contained in:
TwiN
2025-09-16 16:56:36 -04:00
committed by GitHub
parent 39ace63224
commit 37ba305c34
3 changed files with 16 additions and 16 deletions

View File

@@ -43,8 +43,8 @@ const (
)
var (
// ErrNoEndpointInConfig is an error returned when a configuration file or directory has no endpoints configured
ErrNoEndpointInConfig = errors.New("configuration should contain at least 1 endpoint")
// 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")
@@ -286,8 +286,8 @@ func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
return
}
// Check if the configuration file at least has endpoints configured
if config == nil || config.Endpoints == nil || len(config.Endpoints) == 0 {
err = ErrNoEndpointInConfig
if config == nil || (len(config.Endpoints) == 0 && len(config.Suites) == 0) {
err = ErrNoEndpointOrSuiteInConfig
} else {
// XXX: Remove this in v6.0.0
if config.Debug {