(method database.NotificationMethod)
| 21 | ) |
| 22 | |
| 23 | func defaultNotificationsConfig(method database.NotificationMethod) codersdk.NotificationsConfig { |
| 24 | var ( |
| 25 | smtp codersdk.NotificationsEmailConfig |
| 26 | webhook codersdk.NotificationsWebhookConfig |
| 27 | ) |
| 28 | |
| 29 | switch method { |
| 30 | case database.NotificationMethodSmtp: |
| 31 | smtp.Smarthost = serpent.String("localhost:1337") |
| 32 | case database.NotificationMethodWebhook: |
| 33 | webhook.Endpoint = serpent.URL(url.URL{Host: "localhost"}) |
| 34 | } |
| 35 | |
| 36 | return codersdk.NotificationsConfig{ |
| 37 | Method: serpent.String(method), |
| 38 | MaxSendAttempts: 5, |
| 39 | FetchInterval: serpent.Duration(time.Millisecond * 100), |
| 40 | StoreSyncInterval: serpent.Duration(time.Millisecond * 200), |
| 41 | LeasePeriod: serpent.Duration(time.Second * 10), |
| 42 | DispatchTimeout: serpent.Duration(time.Second * 5), |
| 43 | RetryInterval: serpent.Duration(time.Millisecond * 50), |
| 44 | LeaseCount: 10, |
| 45 | StoreSyncBufferSize: 50, |
| 46 | SMTP: smtp, |
| 47 | Webhook: webhook, |
| 48 | Inbox: codersdk.NotificationsInboxConfig{ |
| 49 | Enabled: serpent.Bool(true), |
| 50 | }, |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func defaultHelpers() map[string]any { |
| 55 | return map[string]any{ |
no test coverage detected