chore: add additional fields to license telemetry (#11173)

This sends the email the license was issued to, and whether or not it's a trial in the telemetry payload. It's a bit janky since the license parsing is all enterprise licensed.
This commit is contained in:
Colin Adler
2023-12-14 15:52:52 -06:00
committed by GitHub
parent 06394a5b8c
commit 4672700ef6
5 changed files with 41 additions and 3 deletions

View File

@ -109,6 +109,13 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
}
}()
api.AGPL.Options.ParseLicenseClaims = func(rawJWT string) (email string, trial bool, err error) {
c, err := license.ParseClaims(rawJWT, Keys)
if err != nil {
return "", false, err
}
return c.Subject, c.Trial, nil
}
api.AGPL.Options.SetUserGroups = api.setUserGroups
api.AGPL.Options.SetUserSiteRoles = api.setUserSiteRoles
api.AGPL.SiteHandler.AppearanceFetcher = api.fetchAppearanceConfig