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

Fix Dependencies #25

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up, I'd like to fix how we do this. pino-collada is great for debugging, but it's not what we should use in production. Maybe you can work on that next?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will do, since I'm also working with pino in #2499. I will fix there

});

module.exports = logger;