Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Fix Dependencies:
Browse files Browse the repository at this point in the history
    * Remove elastic-apm-node
    * Remove @elastic/ecs-pino-format
    * Update Jest (To fix deprecated dependencies)
  • Loading branch information
Kevan-Y committed Jan 20, 2022
1 parent b1d9334 commit 2e42afe
Show file tree
Hide file tree
Showing 7 changed files with 4,512 additions and 12,802 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ npm install --save @senecacdot/satellite

## Configure

You need to set the following environment variables if you want Elastic APM
monitoring for your service:

- `ELASTIC_APM_SERVER_URL`: the URL to the APM server (e.g., <http://localhost:8200>)
- `ELASTIC_APM_SERVICE_NAME`: the name of the service as it will appear in APM

If you don't provide these values in your environment, APM monitoring will be
disabled.

In addition, the following JWT verification values are required:
The following JWT verification values are required:

- `SECRET`: the secret used for JWT token verification
- `JWT_AUDIENCE`: the audience (aud) claim expected in JWT token verification
Expand Down
17,258 changes: 4,505 additions & 12,753 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
},
"homepage": "https://github.com/Seneca-CDOT/satellite#readme",
"dependencies": {
"@elastic/ecs-pino-format": "^1.1.1",
"@elastic/elasticsearch": "^7.12.0",
"@elastic/elasticsearch-mock": "^0.3.0",
"@godaddy/terminus": "^4.7.1",
"cors": "2.8.5",
"elastic-apm-node": "^3.14.0",
"express": "4.17.1",
"express-jwt": "^6.0.0",
"express-pino-logger": "^6.0.0",
Expand All @@ -49,7 +47,7 @@
"eslint-plugin-jest": "^25.3.0",
"get-port": "^5.1.1",
"husky": "^5.1.3",
"jest": "^26.6.3",
"jest": "^27.4.7",
"nock": "^13.0.11",
"prettier": "2.2.1",
"pretty-quick": "3.1.0"
Expand Down
16 changes: 0 additions & 16 deletions src/apm.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const createError = require('http-errors');
const expressPino = require('express-pino-logger');

const logger = require('./logger');
const apm = require('./apm');
const { errorHandler } = require('./middleware');

function createApp(router, options = {}) {
Expand Down Expand Up @@ -57,12 +56,6 @@ function createApp(router, options = {}) {
next(createError(404, `${req.originalUrl} not found`));
});

// If we're using APM, add APM error collection
// middleware before default error handler
if (apm) {
app.use(apm.middleware.connect());
}

// Add our default error handler
app.use(errorHandler);

Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('./apm');

const { isAuthenticated, isAuthorized } = require('./middleware');
const { createRouter } = require('./app');

Expand Down
16 changes: 5 additions & 11 deletions src/logger.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
const pino = require('pino');

const usingElastic = process.env.ELASTIC_APM_SERVER_URL && process.env.ELASTIC_APM_SERVICE_NAME;

// Pick our logger based on whether we're using APM monitoring with ELK
let logger = usingElastic
? // Structured JSON logging
pino(require('@elastic/ecs-pino-format')({ convertReqRes: true }))
: // Pretty debug logging
pino({
prettyPrint: {},
prettifier: require('pino-colada'),
});
// Pretty debug logging
let logger = pino({
prettyPrint: {},
prettifier: require('pino-colada'),
});

module.exports = logger;

0 comments on commit 2e42afe

Please sign in to comment.