MakeTemplateArgs wraps event-specific arguments into TemplateArgs object.
(eventArgs notifydata.TypedEventArgs)
| 157 | |
| 158 | // MakeTemplateArgs wraps event-specific arguments into TemplateArgs object. |
| 159 | func MakeTemplateArgs(eventArgs notifydata.TypedEventArgs) TemplateArgs { |
| 160 | now := clock.Now() |
| 161 | |
| 162 | h, _ := os.Hostname() |
| 163 | if h == "" { |
| 164 | h = "unknown hostname" |
| 165 | } |
| 166 | |
| 167 | // prepare template arguments |
| 168 | return TemplateArgs{ |
| 169 | Hostname: h, |
| 170 | EventArgs: eventArgs, |
| 171 | EventTime: now, |
| 172 | KopiaRepo: repo.BuildGitHubRepo, |
| 173 | KopiaBuildInfo: repo.BuildInfo, |
| 174 | KopiaBuildVersion: repo.BuildVersion, |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // SendTo sends a notification to the given sender. |
| 179 | func SendTo(ctx context.Context, rep repo.Repository, s sender.Sender, templateName string, eventArgs notifydata.TypedEventArgs, sev Severity, opt notifytemplate.Options) error { |