dev: Use .env file for Sentry DSN.

Reads .env file in root folder of repo to get Sentry DSN for builds.
This commit is contained in:
Kanishk Kakar
2019-07-19 00:23:10 +05:30
committed by Akash Nimare
parent 95da6c0d58
commit 088ddf9c62
4 changed files with 15 additions and 1 deletions

View File

@@ -1,11 +1,14 @@
import { init } from '@sentry/electron';
import isDev = require('electron-is-dev');
import path = require('path');
import dotenv = require('dotenv');
dotenv.config({ path: path.resolve(__dirname, '/../../../../.env') });
export const sentryInit = (): void => {
if (!isDev) {
init({
dsn: 'SENTRY_DSN',
dsn: process.env.SENTRY_DSN,
// We should ignore this error since it's harmless and we know the reason behind this
// This error mainly comes from the console logs.
// This is a temp solution until Sentry supports disabling the console logs