aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Egorenkov <Alexander.Egorenkov@ibm.com>2020-11-03 08:45:49 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-11-12 19:17:43 +0100
commit16fca0c8ebd6f95e249caa4fbebe9b3b63b508b4 (patch)
tree113cd0f06e42c185eda802b04c6e41c7e6ec443a
parent77a55c8ea6070a9a88715db4c17e9612a7f99b21 (diff)
dashboard/app: add new config parameters for own email(s) and app URL
* Allows using a mail account provider other than Google App Engine * Allows changing the app URL that appears in emails sent by syzbot Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
-rw-r--r--dashboard/app/config.go8
-rw-r--r--dashboard/app/reporting_email.go19
2 files changed, 22 insertions, 5 deletions
diff --git a/dashboard/app/config.go b/dashboard/app/config.go
index fa80cca12..eba1f29a1 100644
--- a/dashboard/app/config.go
+++ b/dashboard/app/config.go
@@ -44,6 +44,14 @@ type GlobalConfig struct {
// Each namespace has own reporting config, own API clients
// and bugs are not merged across namespaces.
Namespaces map[string]*Config
+ // app's own email address which will appear in FROM field of mails sent by the app.
+ OwnEmailAddress string
+ // List of email addresses which are considered app's own email addresses.
+ // All emails sent from one of these email addresses shall be ignored by the app on reception.
+ ExtraOwnEmailAddresses []string
+ // Main part of the URL at which the app is reachable.
+ // This URL is used e.g. to construct HTML links contained in the emails sent by the app.
+ AppURL string
}
// Per-namespace config.
diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go
index 178a64c30..126752437 100644
--- a/dashboard/app/reporting_email.go
+++ b/dashboard/app/reporting_email.go
@@ -514,6 +514,9 @@ var sendEmail = func(c context.Context, msg *aemail.Message) error {
}
func ownEmail(c context.Context) string {
+ if config.OwnEmailAddress != "" {
+ return config.OwnEmailAddress
+ }
return fmt.Sprintf("syzbot@%v.appspotmail.com", appengine.AppID(c))
}
@@ -522,11 +525,14 @@ func fromAddr(c context.Context) string {
}
func ownEmails(c context.Context) []string {
- // Now we use syzbot@ but we used to use bot@, so we add them both.
- return []string{
- ownEmail(c),
- fmt.Sprintf("bot@%v.appspotmail.com", appengine.AppID(c)),
- }
+ emails := []string{ownEmail(c)}
+ if config.ExtraOwnEmailAddresses != nil {
+ emails = append(emails, config.ExtraOwnEmailAddresses...)
+ } else if config.OwnEmailAddress == "" {
+ // Now we use syzbot@ but we used to use bot@, so we add them both.
+ emails = append(emails, fmt.Sprintf("bot@%v.appspotmail.com", appengine.AppID(c)))
+ }
+ return emails
}
func sanitizeCC(c context.Context, cc []string) []string {
@@ -552,6 +558,9 @@ func externalLink(c context.Context, tag string, id int64) string {
}
func appURL(c context.Context) string {
+ if config.AppURL != "" {
+ return config.AppURL
+ }
return fmt.Sprintf("https://%v.appspot.com", appengine.AppID(c))
}