diff --git a/api/.env.example b/api/.env.example index a740a31..2f318f9 100644 --- a/api/.env.example +++ b/api/.env.example @@ -19,6 +19,8 @@ AUTH_END_SESSION_URI= SERVER_PORT=3000 CLIENT_URL= # This is whatever URL the client web app is served on CLIENT_DOMAIN= #whatever.com +APPLICATION_VERSION= # Should match release tag +APPLICATION_ENVIRONMENT= # dev / prod # Glitchtip GLITCHTIP_DSN= diff --git a/api/src/index.js b/api/src/index.js index 383b0c9..00bf5cc 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -20,11 +20,14 @@ const port = process.env.SERVER_PORT; //glitchtip setup const sentry = require('@sentry/node'); -if (process.env.DISABLE_GLITCHTIP) { +if (process.env.DISABLE_GLITCHTIP === "true") { console.log("Glitchtip disabled") } else { let dsn = process.env.GLITCHTIP_DSN; - sentry.init({ dsn: dsn }); + let release = process.env.APPLICATION_VERSION; + let environment = process.env.APPLICATION_ENVIRONMENT; + console.log(release, environment) + sentry.init({ dsn: dsn, release: release, environment: environment }); console.log("Glitchtip initialized"); } @@ -58,6 +61,7 @@ const { roles, memberRoles } = require('./routes/roles'); const { courseRouter, eventRouter } = require('./routes/course'); const { calendarRouter } = require('./routes/calendar') const morgan = require('morgan'); +const { env } = require('process'); app.use('/application', applicationsRouter); app.use('/ranks', ranks); diff --git a/api/src/routes/auth.js b/api/src/routes/auth.js index c0a089b..c736f33 100644 --- a/api/src/routes/auth.js +++ b/api/src/routes/auth.js @@ -21,12 +21,13 @@ passport.use(new OpenIDConnectStrategy({ scope: ['openid', 'profile'] }, async function verify(issuer, sub, profile, jwtClaims, accessToken, refreshToken, params, cb) { - // console.log('--- OIDC verify() called ---'); - // console.log('issuer:', issuer); - // console.log('sub:', sub); + console.log('--- OIDC verify() called ---'); + console.log('issuer:', issuer); + console.log('sub:', sub); // console.log('profile:', JSON.stringify(profile, null, 2)); - // console.log('id_token claims:', JSON.stringify(jwtClaims, null, 2)); - // console.log('preferred_username:', jwtClaims?.preferred_username); + console.log('profile:', profile); + console.log('id_token claims:', JSON.stringify(jwtClaims, null, 2)); + console.log('preferred_username:', jwtClaims?.preferred_username); const con = await pool.getConnection(); try { diff --git a/ui/.env.example b/ui/.env.example index becdf99..176d394 100644 --- a/ui/.env.example +++ b/ui/.env.example @@ -1,6 +1,8 @@ # SITE SETTINGS VITE_APIHOST= VITE_ENVIRONMENT= # dev / prod +VITE_APPLICATION_VERSION= # Should match release tag + # Glitchtip VITE_GLITCHTIP_DSN= diff --git a/ui/src/main.js b/ui/src/main.js index 4d1080a..c7de1da 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -20,10 +20,12 @@ const app = createApp(App) app.use(createPinia()) app.use(router) -if (!import.meta.env.VITE_DISABLE_GLITCHTIP) { +if (import.meta.env.VITE_DISABLE_GLITCHTIP === "true") { + console.log("Glitchtip disabled"); +} else { let dsn = import.meta.env.VITE_GLITCHTIP_DSN; let environment = import.meta.env.VITE_ENVIRONMENT; - + let release = import.meta.env.VITE_APPLICATION_VERSION; Sentry.init({ app, dsn: dsn, @@ -32,7 +34,7 @@ if (!import.meta.env.VITE_DISABLE_GLITCHTIP) { ], tracesSampleRate: 0.01, environment: environment, - release: 'release tag' + release: release }); }