Skip to content

Commit 088ddf9

Browse files
kanishk98akashnimare
authored andcommitted
dev: Use .env file for Sentry DSN.
Reads .env file in root folder of repo to get Sentry DSN for builds.
1 parent 95da6c0 commit 088ddf9

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@sentry/electron": "0.14.0",
3131
"adm-zip": "0.4.11",
3232
"auto-launch": "5.0.5",
33+
"dotenv": "8.0.0",
3334
"electron-is-dev": "0.3.0",
3435
"electron-log": "2.2.14",
3536
"electron-spellchecker": "1.1.2",

app/renderer/js/utils/sentry-util.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { init } from '@sentry/electron';
22

33
import isDev = require('electron-is-dev');
4+
import path = require('path');
5+
import dotenv = require('dotenv');
6+
dotenv.config({ path: path.resolve(__dirname, '/../../../../.env') });
47

58
export const sentryInit = (): void => {
69
if (!isDev) {
710
init({
8-
dsn: 'SENTRY_DSN',
11+
dsn: process.env.SENTRY_DSN,
912
// We should ignore this error since it's harmless and we know the reason behind this
1013
// This error mainly comes from the console logs.
1114
// This is a temp solution until Sentry supports disabling the console logs

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
],
133133
"devDependencies": {
134134
"@types/adm-zip": "^0.4.32",
135+
"@types/dotenv": "6.1.1",
135136
"@typescript-eslint/eslint-plugin": "1.10.2",
136137
"@typescript-eslint/parser": "1.10.2",
137138
"assert": "1.4.1",

0 commit comments

Comments
 (0)