Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added isTgTokenPresent

Blue Mouse46137ea94a06
diff --git a/src/app.module.ts b/src/app.module.ts
index edbbc299f..26e0c1d25 100644
--- a/src/app.module.ts
+++ b/src/app.module.ts
@@ -20,7 +20,7 @@ import { AlertModule } from './alert/alert.module'
import { I18nModule } from 'nestjs-i18n'
import { getI18nConfig } from './configs'
import { AuthModule } from './auth/auth.module'
-import { isDevelopment } from './common/constants'
+import { isDevelopment, isTgTokenPresent } from './common/constants'
const modules = [
ConfigModule.forRoot({ envFilePath: '.env', isGlobal: true }),
@@ -52,7 +52,7 @@ const modules = [
AuthModule,
]
-if (process.env.TG_BOT_TOKEN) {
+if (isTgTokenPresent) {
modules.push(
TelegrafModule.forRoot({
token: process.env.TG_BOT_TOKEN,
diff --git a/src/common/constants.ts b/src/common/constants.ts
index f63ab56a8..190f73ee2 100644
--- a/src/common/constants.ts
+++ b/src/common/constants.ts
@@ -39,6 +39,7 @@ const clickhouse = new ClickHouse({
})
const isSelfhosted = Boolean(process.env.SELFHOSTED)
+const isTgTokenPresent = Boolean(process.env.TG_BOT_TOKEN)
const isDevelopment = process.env.NODE_ENV === 'development'
const isNewRelicEnabled = Boolean(process.env.USE_NEW_RELIC)
const PRODUCTION_ORIGIN = process.env.CLIENT_URL || 'https://swetrix.com'
@@ -230,4 +231,5 @@ export {
REDIS_PERFORMANCE_COUNT_KEY,
isDevelopment,
PRODUCTION_ORIGIN,
+ isTgTokenPresent,
}