MCPcopy Index your code
hub / github.com/coder/coder / fetchHelpers

Method fetchHelpers

coderd/notifications/fetcher.go:12–31  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

10)
11
12func (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
33func (n *notifier) fetchAppName(ctx context.Context) (string, error) {
34 appName, err := n.store.GetApplicationName(ctx)

Callers 2

prepareMethod · 0.95

Calls 3

fetchAppNameMethod · 0.95
fetchLogoURLMethod · 0.95
ErrorfMethod · 0.45

Tested by 1