Documentation
¶
Index ¶
- Variables
- func HashAPIKey(key string) string
- func NormalizeBasePath(s string) string
- type APIKeyConfig
- type AuthConfig
- type Config
- func (c *Config) IsTrustedProxy(ip net.IP) bool
- func (c *Config) IsWebUIEnabled() bool
- func (c *Config) LookupAPIKey(key string) (*APIKeyConfig, bool)
- func (c *Config) LookupAPIKeyByName(name string) *APIKeyConfig
- func (c *Config) ResolvedExternalURL() string
- func (c *Config) TrustedNets() []net.IPNet
- func (c *Config) Validate() error
- type DatabaseConfig
- type LoggingConfig
- type LoginConfig
- type MonitorConfig
- type SMTPConfig
- type ServerConfig
- type SessionConfig
- type SubscriptionsConfig
- type TOTPConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var AllPermissions = []string{
"monitors.read", "monitors.write",
"incidents.read", "incidents.write",
"notifications.read", "notifications.write",
"escalation_policies.read", "escalation_policies.write",
"maintenance.read", "maintenance.write",
"metrics.read",
}
Functions ¶
func HashAPIKey ¶
func NormalizeBasePath ¶
Types ¶
type APIKeyConfig ¶
type APIKeyConfig struct {
Name string `yaml:"name"`
Hash string `yaml:"hash"`
Role string `yaml:"role,omitempty"`
SuperAdmin bool `yaml:"super_admin,omitempty"`
Permissions []string `yaml:"permissions,omitempty"`
TOTP bool `yaml:"totp,omitempty"`
}
func (*APIKeyConfig) HasPermission ¶
func (k *APIKeyConfig) HasPermission(perm string) bool
func (*APIKeyConfig) PermissionMap ¶
func (k *APIKeyConfig) PermissionMap() map[string]bool
type AuthConfig ¶
type AuthConfig struct {
APIKeys []APIKeyConfig `yaml:"api_keys"`
Session SessionConfig `yaml:"session"`
Login LoginConfig `yaml:"login"`
TOTP TOTPConfig `yaml:"totp"`
}
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Database DatabaseConfig `yaml:"database"`
Auth AuthConfig `yaml:"auth"`
Monitor MonitorConfig `yaml:"monitor"`
Logging LoggingConfig `yaml:"logging"`
Subscriptions SubscriptionsConfig `yaml:"subscriptions"`
// contains filtered or unexported fields
}
func (*Config) IsWebUIEnabled ¶
func (*Config) LookupAPIKey ¶
func (c *Config) LookupAPIKey(key string) (*APIKeyConfig, bool)
LookupAPIKey checks if the given key matches any configured API key and returns the key config if found.
func (*Config) LookupAPIKeyByName ¶
func (c *Config) LookupAPIKeyByName(name string) *APIKeyConfig
LookupAPIKeyByName finds an API key config by its name.
func (*Config) ResolvedExternalURL ¶
func (*Config) TrustedNets ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `yaml:"path"`
MaxReadConns int `yaml:"max_read_conns"`
RetentionDays int `yaml:"retention_days"`
RetentionPeriod time.Duration `yaml:"retention_period"`
RequestLogRetentionDays int `yaml:"request_log_retention_days"`
EncryptionKey string `yaml:"encryption_key"`
}
type LoggingConfig ¶
type LoginConfig ¶
type MonitorConfig ¶
type MonitorConfig struct {
Workers int `yaml:"workers"`
DefaultTimeout time.Duration `yaml:"default_timeout"`
DefaultInterval time.Duration `yaml:"default_interval"`
FailureThreshold int `yaml:"failure_threshold"`
SuccessThreshold int `yaml:"success_threshold"`
MaxConcurrentDNS int `yaml:"max_concurrent_dns"`
CommandTimeout time.Duration `yaml:"command_timeout"`
CommandAllowlist []string `yaml:"command_allowlist"`
HeartbeatCheckInterval time.Duration `yaml:"heartbeat_check_interval"`
AllowPrivateTargets bool `yaml:"allow_private_targets"`
AdaptiveIntervals bool `yaml:"adaptive_intervals"`
}
type SMTPConfig ¶ added in v1.2.0
type ServerConfig ¶
type ServerConfig struct {
Listen string `yaml:"listen"`
TLSCert string `yaml:"tls_cert"`
TLSKey string `yaml:"tls_key"`
ReadTimeout time.Duration `yaml:"read_timeout"`
WriteTimeout time.Duration `yaml:"write_timeout"`
IdleTimeout time.Duration `yaml:"idle_timeout"`
MaxBodySize int64 `yaml:"max_body_size"`
CORSOrigins []string `yaml:"cors_origins"`
RateLimitPerSec float64 `yaml:"rate_limit_per_sec"`
RateLimitBurst int `yaml:"rate_limit_burst"`
WebUIEnabled *bool `yaml:"web_ui_enabled"`
FrameAncestors []string `yaml:"frame_ancestors"`
BasePath string `yaml:"base_path"`
ExternalURL string `yaml:"external_url"`
TrustedProxies []string `yaml:"trusted_proxies"`
}
type SessionConfig ¶
type SubscriptionsConfig ¶ added in v1.2.0
type SubscriptionsConfig struct {
Enabled bool `yaml:"enabled"`
SMTP SMTPConfig `yaml:"smtp"`
}
type TOTPConfig ¶
type TOTPConfig struct {
Required bool `yaml:"required"`
}
Click to show internal directories.
Click to hide internal directories.