web: update for new config api

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-29 13:58:00 +01:00
parent 1193b9fd22
commit a2b38caf64

View file

@ -11,7 +11,7 @@ export const TAG_SENTRY_CAPABILITIES = "authentik.capabilities";
export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
return config().then((config) => {
if (config.errorReportingEnabled) {
if (config.errorReporting.enabled) {
Sentry.init({
dsn: "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8",
ignoreErrors: [
@ -25,8 +25,8 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
tracingOrigins: [window.location.host, "localhost"],
}),
],
tracesSampleRate: 0.6,
environment: config.errorReportingEnvironment,
tracesSampleRate: config.errorReporting.tracesSampleRate,
environment: config.errorReporting.environment,
beforeSend: async (event: Sentry.Event, hint: Sentry.EventHint): Promise<Sentry.Event | null> => {
if (hint.originalException instanceof SentryIgnoredError) {
return null;
@ -43,7 +43,7 @@ export function configureSentry(canDoPpi: boolean = false): Promise<Config> {
const intf = window.location.pathname.replace(/.+if\/(.+)\//, "$1");
Sentry.setTag(TAG_SENTRY_COMPONENT, `web/${intf}`);
}
if (config.errorReportingSendPii && canDoPpi) {
if (config.errorReporting.sendPii && canDoPpi) {
me().then(user => {
Sentry.setUser({ email: user.user.email });
console.debug("authentik/config: Sentry with PII enabled.");