Skip to content

Commit

Permalink
makes sentry init optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tdjsnelling committed Feb 10, 2023
1 parent eb88980 commit a9e3a63
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 44 deletions.
1 change: 1 addition & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:16-alpine
ENV NODE_ENV=production
ENV SENTRY_DSN="https://[email protected]/4504645996576768"
LABEL org.opencontainers.image.source=https://github.com/tdjsnelling/sqtracker
WORKDIR /sqtracker/app
COPY . .
Expand Down
24 changes: 13 additions & 11 deletions api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,20 @@ import createAdminUser from './setup/createAdminUser'

validateConfig()

Sentry.init({
dsn: 'https://[email protected]/4504645996576768',
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})

Sentry.setContext('deployment', {
name: process.env.SQ_SITE_NAME,
url: process.env.SQ_BASE_URL,
adminEmail: process.env.SQ_ADMIN_EMAIL,
})
Sentry.setContext('deployment', {
name: process.env.SQ_SITE_NAME,
url: process.env.SQ_BASE_URL,
adminEmail: process.env.SQ_ADMIN_EMAIL,
})
}

const connectToDb = () => {
console.log('[sq] initiating db connection...')
Expand Down
1 change: 1 addition & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN ./node_modules/.bin/next build

FROM node:16-alpine
ENV NODE_ENV=production
ENV SENTRY_DSN="https://[email protected]/4504646040616960"
LABEL org.opencontainers.image.source=https://github.com/tdjsnelling/sqtracker
WORKDIR /sqtracker/client
COPY --from=builder /sqtracker/node_modules ./node_modules
Expand Down
24 changes: 13 additions & 11 deletions client/sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import * as Sentry from '@sentry/nextjs'
import config from '../config'

Sentry.init({
dsn: 'https://[email protected]/4504646040616960',
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})

Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
}
24 changes: 13 additions & 11 deletions client/sentry.edge.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import * as Sentry from '@sentry/nextjs'
import config from '../config'

Sentry.init({
dsn: 'https://[email protected]/4504646040616960',
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})

Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
}
24 changes: 13 additions & 11 deletions client/sentry.server.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import * as Sentry from '@sentry/nextjs'
import config from '../config'

Sentry.init({
dsn: 'https://[email protected]/4504646040616960',
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
environment:
process.env.NODE_ENV === 'production' ? 'production' : 'development',
})

Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
Sentry.setContext('deployment', {
name: config.envs.SQ_SITE_NAME,
url: config.envs.SQ_BASE_URL,
adminEmail: config.secrets.SQ_ADMIN_EMAIL,
})
}

0 comments on commit a9e3a63

Please sign in to comment.