diff --git a/config/config.go b/config/config.go index 8413632f..ba1a7495 100644 --- a/config/config.go +++ b/config/config.go @@ -33,6 +33,7 @@ var ( PhoneNumberSupport phonenumbers.PhoneNumber PhoneNumberSupportStr string SentryDSN string + SentryDSNFrontend string StadiaMapsAPIKey string TextProvider string TwilioAuthToken string @@ -168,6 +169,10 @@ func Parse() (err error) { if SentryDSN == "" { return fmt.Errorf("You must specify a non-empty SENTRY_DSN") } + SentryDSNFrontend = os.Getenv("SENTRY_DSN_FRONTEND") + if SentryDSNFrontend == "" { + return fmt.Errorf("You must specify a non-empty SENTRY_DSN_FRONTEND") + } StadiaMapsAPIKey = os.Getenv("STADIA_MAPS_API_KEY") if StadiaMapsAPIKey == "" { return fmt.Errorf("You must specify a non-empty STADIA_MAPS_API_KEY") diff --git a/main.go b/main.go index ed7a67bf..29fc703c 100644 --- a/main.go +++ b/main.go @@ -158,6 +158,7 @@ func main() { chan_envelope := make(chan platform.Envelope, 10) api.SetVersion(Version) + resource.SetVersion(Version) platform.SetEventChannel(chan_envelope) api.SetEventChannel(chan_envelope) diff --git a/resource/session.go b/resource/session.go index 733c5cc4..2d3ddadf 100644 --- a/resource/session.go +++ b/resource/session.go @@ -30,11 +30,17 @@ type organization struct { type session struct { Impersonating *string `json:"impersonating"` + Frontend sessionFrontend `json:"frontend"` NotificationCounts sessionNotificationCounts `json:"notification_counts"` Organization organization `json:"organization"` Self user `json:"self"` URLs sessionURL `json:"urls"` } +type sessionFrontend struct { + Environment string `json:"environment"` + SentryDSN string `json:"sentry_dsn"` + Version string `json:"version"` +} type sessionNotificationCounts struct { Communications uint `json:"communication"` Home uint `json:"home"` @@ -83,6 +89,11 @@ func (res *sessionR) Get(ctx context.Context, r *http.Request, user platform.Use } return &session{ Impersonating: impersonating, + Frontend: sessionFrontend{ + Environment: config.Environment, + SentryDSN: config.SentryDSNFrontend, + Version: version, + }, NotificationCounts: sessionNotificationCounts{ Communications: counts.Communications, Home: counts.Home, @@ -114,3 +125,9 @@ func (res *sessionR) Get(ctx context.Context, r *http.Request, user platform.Use }, }, nil } + +var version string = "unknown" + +func SetVersion(v string) { + version = v +}