Add config validation and dashboard
Add YAML config loading with validation, env overrides for secrets, and a web dashboard exposing health, stats, and recent events.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
module sources
|
||||
|
||||
pub fn transform_http_down(check HttpCheck, err string) Event {
|
||||
mut message := ''
|
||||
if check.template != '' {
|
||||
vars := {
|
||||
'url': check.url
|
||||
'error': err
|
||||
'status': ''
|
||||
}
|
||||
message = render_source_template(check.template, vars)
|
||||
} else {
|
||||
message = '❌ ${check.url} → ${err}'
|
||||
}
|
||||
return Event{
|
||||
source: 'http_poll'
|
||||
name: check.url
|
||||
topic: check.topic
|
||||
priority: check.priority
|
||||
tags: ['x']
|
||||
message: message
|
||||
raw: err
|
||||
}
|
||||
}
|
||||
|
||||
pub fn transform_http_up(check HttpCheck) Event {
|
||||
message := '✅ ${check.url} is UP'
|
||||
return Event{
|
||||
source: 'http_poll'
|
||||
name: check.url
|
||||
topic: check.topic
|
||||
priority: 1
|
||||
tags: ['white_check_mark']
|
||||
message: message
|
||||
raw: ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user