Skip to content

Commit

Permalink
Integrate Sentry
Browse files Browse the repository at this point in the history
The application will report to sentry if the sentry environment
variables are specified.

Issue #4
  • Loading branch information
slifty committed Jan 7, 2022
1 parent daf3969 commit 99124c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Your Sentry Data Source Name (DSN)
# See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
# e.g. https://[email protected]/here"
SENTRY_DSN=${SENTRY_DSN}

# The environment tag to associate with sentry entries
# See https://docs.sentry.io/product/sentry-basics/environments/
# e.g. localhost
SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ This project uses NodeJS 16.x and contains an implementation of the SFTP protoco
npm install
```

2. Start the service
2. Configure your `.env`

```
cp .env.example .env
vi .env
```

3. Start the service

```
npm start
Expand Down
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Sentry from '@sentry/node';

if ('SENTRY_DSN' in process.env
&& 'SENTRY_ENVIRONMENT' in process.env) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1,
environment: process.env.SENTRY_ENVIRONMENT,
});
}

0 comments on commit 99124c0

Please sign in to comment.