| 10 | ) |
| 11 | |
| 12 | func (n *notifier) fetchHelpers(ctx context.Context) (map[string]any, error) { |
| 13 | appName, err := n.fetchAppName(ctx) |
| 14 | if err != nil { |
| 15 | return nil, xerrors.Errorf("fetch app name: %w", err) |
| 16 | } |
| 17 | logoURL, err := n.fetchLogoURL(ctx) |
| 18 | if err != nil { |
| 19 | return nil, xerrors.Errorf("fetch logo URL: %w", err) |
| 20 | } |
| 21 | |
| 22 | helpers := make(template.FuncMap) |
| 23 | for k, v := range n.helpers { |
| 24 | helpers[k] = v |
| 25 | } |
| 26 | |
| 27 | helpers["app_name"] = func() string { return appName } |
| 28 | helpers["logo_url"] = func() string { return logoURL } |
| 29 | |
| 30 | return helpers, nil |
| 31 | } |
| 32 | |
| 33 | func (n *notifier) fetchAppName(ctx context.Context) (string, error) { |
| 34 | appName, err := n.store.GetApplicationName(ctx) |