Documentation
¶
Index ¶
- Constants
- Variables
- func EmbeddedConfigReadFile(name string) ([]byte, error)
- func NewConfigOps() types.ConfigOps
- func Open(name string) (fs.File, error)
- func ReadDir(name string) ([]fs.DirEntry, error)
- func ValidHandlerNames() []string
- func ValidNotifierNames() []string
- func ValidWorkerNames() []string
- func ValidateConfigFile(cf *ConfigFile) []string
- func WriteConfigFile(p string, cf *ConfigFile) error
- type App
- type Config
- type ConfigFile
Constants ¶
const ( // IgnoreCIDRsKey is a comma-separated list of source IPs/CIDRs to drop. IgnoreCIDRsKey = "ignore_cidrs" // IgnorePatternKey is a regex matched against the event FilterString // ("HANDLER ACTION DETAIL from IP[,IP...]"), so it can select on handler, // method, path, or source IP — e.g. "^HTTPX GET /old-test-callback". IgnorePatternKey = "ignore_pattern" )
Config keys (under `defaults:`) for the global ignore/drop list. An event matching either rule is discarded before it is persisted or dispatched to notifiers — no DB row, no notification, no log line. Use this to silence a known-noisy source (e.g. a leftover beacon from an old test that keeps calling back every second) without muting the rest of your traffic.
const ConfigFileName = "xodbox.yaml"
const DefaultNotifyFilter = "^/l"
Variables ¶
var ConfigFilePath string
ConfigFilePath is the path to the active config file, set by LoadConfig.
var EmbeddedConfig embed.FS
Functions ¶
func EmbeddedConfigReadFile ¶ added in v0.0.7
func NewConfigOps ¶ added in v0.1.3
NewConfigOps returns a types.ConfigOps backed by the package-level config state.
func ValidHandlerNames ¶ added in v0.1.3
func ValidHandlerNames() []string
func ValidNotifierNames ¶ added in v0.1.3
func ValidNotifierNames() []string
func ValidWorkerNames ¶ added in v0.1.3
func ValidWorkerNames() []string
func ValidateConfigFile ¶ added in v0.1.3
func ValidateConfigFile(cf *ConfigFile) []string
ValidateConfigFile checks that every handler, notifier, and worker entry references a registered name. It returns a slice of human-readable errors (empty when valid).
func WriteConfigFile ¶ added in v0.1.3
func WriteConfigFile(p string, cf *ConfigFile) error
WriteConfigFile marshals cf to YAML and writes it atomically to path.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) GetTemplateData ¶
func (*App) RegisterNotificationHandler ¶
func (*App) Reload ¶ added in v0.1.3
Reload stops all running handlers/workers, reloads config from disk, and starts the new handlers/workers. The event loop and persister keep running across the reload. Returns an error if the new config is invalid; in that case the old handlers are already stopped — a second Reload with a fixed config will recover.
type Config ¶
type Config struct {
TemplateData map[string]string `yaml:"template_data"`
Handlers []types.Handler
Notifiers []types.Notifier
Workers []types.Worker
}
Config used by App for bootstrapping
func LoadConfig ¶
LoadConfig creates a Config from the yaml contents in configFile
func ToConfig ¶ added in v0.1.3
func ToConfig(conf *ConfigFile) *Config
ToConfig creates a Config struct based on the ConfigFile
type ConfigFile ¶
type ConfigFile = types.ConfigFile
ConfigFile is an alias for types.ConfigFile kept for backward compatibility within this package and its tests.
func ConfigFromFile ¶ added in v0.1.3
func ConfigFromFile(configFile string) (*ConfigFile, error)
ConfigFromFile returns ConfigFile loaded from a file.