MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / pushByLegacyMethod

Function pushByLegacyMethod

agent/utils/alert_push/alert_push.go:51–67  ·  view source on GitHub ↗
(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, method string)

Source from the content-addressed store, hash-verified

49}
50
51func pushByLegacyMethod(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, method string) {
52 typeMap := map[string]string{
53 "mail": constant.Email,
54 constant.Bark: constant.Bark,
55 constant.SMS: constant.SMS,
56 }
57 configType := method
58 if mapped, ok := typeMap[method]; ok {
59 configType = mapped
60 }
61 config, err := alertRepo.GetConfig(alertRepo.WithByType(configType))
62 if err != nil {
63 global.LOG.Errorf("alert config not found for type %s: %v", configType, err)
64 return
65 }
66 sendAlert(alertRepo, alert, pushAlert, config)
67}
68
69func sendAlert(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, config model.AlertConfig) {
70 if !alertUtil.IsAlertConfigEnabled(config) {

Callers 1

PushAlertFunction · 0.85

Calls 3

sendAlertFunction · 0.85
GetConfigMethod · 0.65
WithByTypeMethod · 0.65

Tested by

no test coverage detected