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