Skip to content

Commit

Permalink
tech: add sentry auth token env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault authored and maximeperraultdev committed Dec 11, 2024
1 parent be64ffa commit 60e0dcf
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 29 deletions.
1 change: 1 addition & 0 deletions .env.dev.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ FRONTEND_SHOM_KEY=
FRONTEND_SENTRY_ENV=dev
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=localhost
FRONTEND_SENTRY_AUTH_TOKEN=DUMMY_TOKEN

################################################################################
# Feature flags
Expand Down
1 change: 1 addition & 0 deletions .env.infra.example
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ FRONTEND_SHOM_KEY=
FRONTEND_SENTRY_ENV=
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=
FRONTEND_SENTRY_AUTH_TOKEN=

################################################################################
# Feature flags
Expand Down
3 changes: 2 additions & 1 deletion .env.test.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ FRONTEND_SHOM_KEY=
FRONTEND_SENTRY_ENV=dev
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=localhost
FRONTEND_SENTRY_AUTH_TOKEN=DUMMY_TOKEN

################################################################################
# Feature flags
Expand Down Expand Up @@ -115,4 +116,4 @@ FRONTEND_OIDC_REDIRECT_URI=http://localhost:3000/login
# MATOMO

FRONTEND_MATOMO_URL=
FRONTEND_MATOMO_ID=
FRONTEND_MATOMO_ID=
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- FRONTEND_MONITORENV_VERSION=${MONITORENV_VERSION}
- FRONTEND_SENTRY_DSN=${SENTRY_DSN}
- FRONTEND_SENTRY_ENV=${ENVIRONMENT}
- FRONTEND_SENTRY_AUTH_TOKEN=${FRONTEND_SENTRY_AUTH_TOKEN}
- FRONTEND_SENTRY_TRACING_ORIGIN=${FRONTEND_SENTRY_TRACING_ORIGIN}
- FRONTEND_SHOM_KEY=${FRONTEND_SHOM_KEY}
- FRONTEND_MISSION_FORM_AUTO_UPDATE=${FRONTEND_MISSION_FORM_AUTO_UPDATE}
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.frontend.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FRONTEND_SHOM_KEY=
FRONTEND_SENTRY_ENV=
FRONTEND_SENTRY_DSN=
FRONTEND_SENTRY_TRACING_ORIGIN=
FRONTEND_SENTRY_AUTH_TOKEN=

################################################################################
# Feature flags
Expand Down
1 change: 1 addition & 0 deletions frontend/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface ImportMetaEnv {
readonly FRONTEND_OIDC_REDIRECT_URI: string
readonly FRONTEND_REPORTING_FORM_AUTO_SAVE_ENABLED: string
readonly FRONTEND_REPORTING_FORM_AUTO_UPDATE: string
readonly FRONTEND_SENTRY_AUTH_TOKEN: string
readonly FRONTEND_SENTRY_DSN: string
readonly FRONTEND_SENTRY_ENV: string
readonly FRONTEND_SENTRY_TRACING_ORIGIN: string
Expand Down
62 changes: 34 additions & 28 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,47 @@
import importMetaEnv from '@import-meta-env/unplugin'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import svgr from 'vite-plugin-svgr'
import viteTsconfigPaths from 'vite-tsconfig-paths'

// https://vitejs.dev/config/
// eslint-disable-next-line import/no-default-export
export default defineConfig({
build: {
outDir: './build',
sourcemap: true
},
export default defineConfig(({ mode }) => {
// @see https://vite.dev/config/#using-environment-variables-in-config
const env = loadEnv(mode, process.cwd(), '')

plugins: [
react(),
viteTsconfigPaths(),
svgr(),
importMetaEnv.vite({
env: './.env',
example: './.env.frontend.example'
}),
sentryVitePlugin({
org: 'betagouv',
project: 'monitorenv',
url: 'https://sentry.incubateur.net/'
})
],
return {
build: {
outDir: './build',
sourcemap: true
},

server: {
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8880'
},
'/bff': {
target: 'http://localhost:8880'
plugins: [
react(),
viteTsconfigPaths(),
svgr(),
importMetaEnv.vite({
env: './.env',
example: './.env.frontend.example'
}),
sentryVitePlugin({
org: 'betagouv',
project: 'monitorenv',
url: 'https://sentry.incubateur.net/',
authToken: env.FRONTEND_SENTRY_AUTH_TOKEN
})
],

server: {
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8880'
},
'/bff': {
target: 'http://localhost:8880'
}
}
}
}
Expand Down

0 comments on commit 60e0dcf

Please sign in to comment.