module sources pub struct Event { pub mut: source string name string topic string priority int tags []string message string raw string } pub fn (e Event) clone() Event { return Event{ source: e.source name: e.name topic: e.topic priority: e.priority tags: e.tags.clone() message: e.message raw: e.raw } } pub struct GiteaSource { pub mut: name string @[json: 'name'] webhook_path string @[json: 'webhook_path'] topic string @[json: 'topic'] template string @[json: 'template'] priority_map map[string]int @[json: 'priority_map'] tags []string @[json: 'tags'] repo string @[json: 'repo'] } pub struct UptimeKumaState { pub mut: priority int @[json: 'priority'] tags []string @[json: 'tags'] } pub struct UptimeKumaSource { pub mut: name string @[json: 'name'] webhook_path string @[json: 'webhook_path'] topic string @[json: 'topic'] template string @[json: 'template'] priority_map map[string]int @[json: 'priority_map'] tags []string @[json: 'tags'] state_map map[string]UptimeKumaState @[json: 'state_map'] } pub struct DockerSource { pub mut: name string @[json: 'name'] topic string @[json: 'topic'] template string @[json: 'template'] priority_map map[string]int @[json: 'priority_map'] tags []string @[json: 'tags'] hosts []string @[json: 'hosts'] events []string @[json: 'events'] } pub struct HttpCheck { pub mut: url string @[json: 'url'] topic string @[json: 'topic'] priority int @[json: 'priority'] expect_status int @[json: 'expect_status'] timeout int @[json: 'timeout'] template string @[json: 'template'] } pub struct HttpPollSource { pub mut: name string @[json: 'name'] interval int @[json: 'interval'] checks []HttpCheck @[json: 'checks'] } pub struct CronSource { pub mut: name string @[json: 'name'] webhook_path string @[json: 'webhook_path'] topic string @[json: 'topic'] template string @[json: 'template'] priority_map map[string]int @[json: 'priority_map'] tags []string @[json: 'tags'] } pub struct GenericSource { pub mut: name string @[json: 'name'] webhook_path string @[json: 'webhook_path'] topic string @[json: 'topic'] template string @[json: 'template'] priority_map map[string]int @[json: 'priority_map'] tags []string @[json: 'tags'] } // render_source_template applies variable substitution to a template string. // Placeholders are {varname}. Shared by all source transformers in this module. pub fn render_source_template(template string, vars map[string]string) string { mut result := template.clone() for key, value in vars { placeholder := '{${key}}' result = result.replace(placeholder, value) } return result }