config

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: MIT Imports: 15 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"
)

Variables

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

	// ErrConfigFileNotFound is an error returned when the 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

This section is empty.

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"`

	// 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"`

	// 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
	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"`

	// Endpoints List of endpoints to monitor
	Endpoints []*core.Endpoint `yaml:"endpoints"`

	// Services List of endpoints to monitor
	//
	// XXX: Remove this in v5.0.0
	// XXX: This is not a typo -- not v4.0.0, but v5.0.0 -- I want to give enough time for people to migrate
	//
	// Deprecated in favor of Endpoints
	Services []*core.Endpoint `yaml:"services"`

	// Storage is the configuration for how the data is stored
	Storage *storage.Config `yaml:"storage"`

	// Web is the web configuration for the application
	Web *web.Config `yaml:"web"`

	// UI is the configuration for the UI
	UI *ui.Config `yaml:"ui"`

	// Maintenance is the configuration for creating a maintenance window in which no alerts are sent
	Maintenance *maintenance.Config `yaml:"maintenance"`
	// contains filtered or unexported fields
}

Config is the main configuration structure

func Load

func Load(configFile string) (*Config, 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() (*Config, error)

LoadDefaultConfiguration loads the default configuration file

func (Config) HasLoadedConfigurationFileBeenModified

func (config Config) HasLoadedConfigurationFileBeenModified() bool

HasLoadedConfigurationFileBeenModified returns whether 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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