fix: send discord notifications only from the staging server

This commit is contained in:
Hossein Mehrabi 2023-09-12 12:16:57 +03:30
parent 81dd4fb8fe
commit aa4f024dea
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
1 changed files with 4 additions and 1 deletions

View File

@ -32,9 +32,12 @@ import { UnbodyHelpers } from './unbody.helpers'
const isBuildTime = process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD
const isVercel = process.env.VERCEL === '1'
const websiteUrl = getWebsiteUrl()
const discordWebhookURL = process.env.DISCORD_LOGS_WEBHOOK_URL || ''
const sendDiscordNotifications =
process.env.NODE_ENV === 'production' && !!discordWebhookURL
process.env.NODE_ENV === 'production' &&
!!discordWebhookURL &&
websiteUrl.includes('dev-') // temporary solution to avoid sending duplicate notification messages
const discordWebhook = new WebhookClient({
url: discordWebhookURL,