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 main
|
||||
|
||||
import sources
|
||||
|
||||
fn test_transform_gitea_push() {
|
||||
raw := '{"repository":{"full_name":"bruno/flowdeck"},"pusher":{"username":"bruno"},"commits":[{"message":"Fix bug","id":"a3f2c1d1234567890"}]}'
|
||||
src := sources.GiteaSource{
|
||||
name: 'FlowDeck'
|
||||
webhook_path: '/webhooks/gitea-flowdeck'
|
||||
topic: 'dev-notifs'
|
||||
priority_map: {
|
||||
'push': 2
|
||||
}
|
||||
}
|
||||
event := sources.transform_gitea(raw, src) or { panic(err) }
|
||||
assert event.source == 'gitea'
|
||||
assert event.topic == 'dev-notifs'
|
||||
assert event.priority == 2
|
||||
assert event.message.contains('bruno/flowdeck')
|
||||
assert event.message.contains('bruno')
|
||||
assert event.message.contains('Fix bug')
|
||||
}
|
||||
|
||||
fn test_transform_gitea_pull_request() {
|
||||
raw := '{"repository":{"full_name":"bruno/flowdeck"},"action":"opened","pull_request":{"title":"New feature","merge_commit_sha":"abc123"}}'
|
||||
src := sources.GiteaSource{
|
||||
name: 'FlowDeck'
|
||||
webhook_path: '/webhooks/gitea-flowdeck'
|
||||
topic: 'dev-notifs'
|
||||
priority_map: {
|
||||
'pull_request': 4
|
||||
}
|
||||
}
|
||||
event := sources.transform_gitea(raw, src) or { panic(err) }
|
||||
assert event.priority == 4
|
||||
assert event.message.contains('New feature')
|
||||
}
|
||||
Reference in New Issue
Block a user