Skip to content

Commit

Permalink
Merge pull request #257 from UniversityOfHelsinkiCS/OOD-12-13-40-no-s…
Browse files Browse the repository at this point in the history
…entry-or-winston-gelf-for-fd

OOD-12-13-40: no sentryDns or winstonGelf for service-provider Fd
  • Loading branch information
valtterikantanen authored Jul 30, 2024
2 parents 8ead7d4 + eae8747 commit 14ed0be
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docker-compose.fd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ services:
NATS_URI: nats://importer-nats:4222
NATS_TOKEN: dev
REDIS_URI: redis://importer-redis:6379
SERVICE_PROVIDER: fd
volumes:
- ./importer-mankeli:/opt/app-root/src

Expand Down Expand Up @@ -86,6 +87,7 @@ services:
DB_HOST: importer-db
DB_DATABASE: importer-db
REDIS_URI: redis://importer-redis:6379
SERVICE_PROVIDER: fd
ports:
- 3005:3000
volumes:
Expand Down
2 changes: 1 addition & 1 deletion importer-api/src/utils/graphqlApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const axios = require('axios').default
const fs = require('fs')
const https = require('https')

const SERVICE_PROVIDER = require('../config')
const { SERVICE_PROVIDER } = require('../config')
const { retry } = require('./index')
const { SIS_API_URL, PROXY_TOKEN, KEY_PATH, CERT_PATH, API_KEY } = process.env

Expand Down
4 changes: 2 additions & 2 deletions importer-api/src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const os = require('os')
const winston = require('winston')
const { WinstonGelfTransporter } = require('winston-gelf-transporter')

const { IS_DEV } = require('../config')
const { IS_DEV, SERVICE_PROVIDER } = require('../config')
const { combine, timestamp, printf, splat } = winston.format

const transports = []
Expand Down Expand Up @@ -45,7 +45,7 @@ if (!IS_DEV) {

transports.push(new winston.transports.Console({ format: prodFormat }))

if (!process.env.STAGING) {
if (!process.env.STAGING && !SERVICE_PROVIDER === 'fd') {
transports.push(
new WinstonGelfTransporter({
handleExceptions: true,
Expand Down
7 changes: 5 additions & 2 deletions importer-db-api/src/utils/sentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ const Sentry = require('@sentry/node')
const Tracing = require('@sentry/tracing') // eslint-disable-line

const initializeSentry = app => {
if (process.env.NODE_ENV !== 'production') return
if (process.env.NODE_ENV !== 'production' || (process.env.SERVICE_PROVIDER === 'fd' && !process.env.SENTRY_DSN))
return

const sentryDSN = process.env.SENTRY_DSN || 'https://eacaccbb66a62f268b3241ddc4da8519@toska.cs.helsinki.fi/9'

Sentry.init({
dsn: 'https://eacaccbb66a62f268b3241ddc4da8519@toska.cs.helsinki.fi/9',
dsn: sentryDSN,
integrations: [new Sentry.Integrations.Http({ tracing: true }), new Tracing.Integrations.Express({ app })],
tracesSampleRate: 1.0
})
Expand Down
2 changes: 1 addition & 1 deletion importer-mankeli/src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (!IS_DEV) {

transports.push(new winston.transports.Console({ format: prodFormat }))

if (!process.env.STAGING) {
if (!process.env.STAGING && !process.env.SERVICE_PROVIDER === 'fd') {
transports.push(
new WinstonGelfTransporter({
handleExceptions: true,
Expand Down
7 changes: 5 additions & 2 deletions importer-mankeli/src/utils/sentry.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const Sentry = require('@sentry/node')

const initializeSentry = () => {
if (process.env.NODE_ENV !== 'production') return
if (process.env.NODE_ENV !== 'production' || (process.env.SERVICE_PROVIDER === 'fd' && !process.env.SENTRY_DSN))
return

const sentryDSN = process.env.SENTRY_DSN || 'https://eacaccbb66a62f268b3241ddc4da8519@toska.cs.helsinki.fi/9'

Sentry.init({
dsn: 'https://eacaccbb66a62f268b3241ddc4da8519@toska.cs.helsinki.fi/9'
dsn: sentryDSN
})
}

Expand Down

0 comments on commit 14ed0be

Please sign in to comment.