@apolitical/server 2.4.2 → 2.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.5.0] - 2022-05-06
|
|
9
|
+
### Added
|
|
10
|
+
- Custom `livenessCheck` to define liveness externally
|
|
11
|
+
|
|
8
12
|
## [2.4.2] - 2022-03-03
|
|
9
13
|
### Bumped
|
|
10
14
|
- Version number for testing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apolitical/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0-rc.1",
|
|
4
4
|
"description": "Node.js module to encapsulate Apolitical's express server setup",
|
|
5
5
|
"author": "Apolitical Group Limited <engineering@apolitical.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,41 +26,41 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@apolitical/logger": "2.0.1",
|
|
28
28
|
"@cloudnative/health-connect": "2.1.0",
|
|
29
|
-
"awilix": "
|
|
30
|
-
"body-parser": "1.
|
|
29
|
+
"awilix": "7.0.3",
|
|
30
|
+
"body-parser": "1.20.0",
|
|
31
31
|
"compression": "1.7.4",
|
|
32
32
|
"cookie-parser": "1.4.6",
|
|
33
33
|
"cors": "2.8.5",
|
|
34
|
-
"dotenv": "
|
|
35
|
-
"express": "4.
|
|
36
|
-
"express-jwt": "6.
|
|
34
|
+
"dotenv": "16.0.0",
|
|
35
|
+
"express": "4.18.1",
|
|
36
|
+
"express-jwt": "7.6.2",
|
|
37
37
|
"http-status-codes": "2.2.0",
|
|
38
|
-
"http-terminator": "3.0
|
|
39
|
-
"jsrsasign": "10.5.
|
|
40
|
-
"jwks-rsa": "2.
|
|
38
|
+
"http-terminator": "3.2.0",
|
|
39
|
+
"jsrsasign": "10.5.20",
|
|
40
|
+
"jwks-rsa": "2.1.1",
|
|
41
41
|
"jwt-decode": "3.1.2",
|
|
42
42
|
"morgan": "1.10.0",
|
|
43
43
|
"passport": "0.5.2",
|
|
44
44
|
"passport-jwt": "4.0.0",
|
|
45
|
-
"prerender-node": "3.
|
|
45
|
+
"prerender-node": "3.5.0",
|
|
46
46
|
"swagger-ui-express": "4.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@apolitical/eslint-config": "
|
|
49
|
+
"@apolitical/eslint-config": "2.0.0",
|
|
50
50
|
"@apolitical/testing": "1.0.2",
|
|
51
|
-
"audit-ci": "
|
|
51
|
+
"audit-ci": "6.2.0",
|
|
52
52
|
"husky": "7.0.4",
|
|
53
|
-
"jest": "
|
|
54
|
-
"jest-junit": "13.
|
|
55
|
-
"lint-staged": "12.
|
|
56
|
-
"mock-jwks": "1.0.
|
|
57
|
-
"nock": "13.2.
|
|
53
|
+
"jest": "28.1.0",
|
|
54
|
+
"jest-junit": "13.2.0",
|
|
55
|
+
"lint-staged": "12.4.1",
|
|
56
|
+
"mock-jwks": "1.0.3",
|
|
57
|
+
"nock": "13.2.4"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=16.13.0"
|
|
61
61
|
},
|
|
62
62
|
"eslintConfig": {
|
|
63
|
-
"extends": "@apolitical/eslint-config/
|
|
63
|
+
"extends": "@apolitical/eslint-config/api.config"
|
|
64
64
|
},
|
|
65
65
|
"prettier": "@apolitical/eslint-config/prettier.config",
|
|
66
66
|
"jest": {
|
package/src/config.js
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
module.exports = ({ health, config, logger }) => {
|
|
4
4
|
const { LIVENESS, READINESS } = config.ENDPOINTS.PROBES;
|
|
5
5
|
|
|
6
|
-
return function load(app) {
|
|
6
|
+
return function load(app, { livenessCheck }) {
|
|
7
7
|
const childLogger = logger.where(__filename, 'load');
|
|
8
8
|
childLogger.debug('Started');
|
|
9
9
|
// Setup health checker
|
|
10
10
|
const healthCheck = new health.HealthChecker();
|
|
11
|
+
// Overwrite live check when it is defined
|
|
12
|
+
if (livenessCheck) {
|
|
13
|
+
healthCheck.registerLivenessCheck(new health.LivenessCheck('livenessCheck', livenessCheck));
|
|
14
|
+
}
|
|
11
15
|
// Load probes endpoints
|
|
12
16
|
app.get(LIVENESS, health.LivenessEndpoint(healthCheck));
|
|
13
17
|
app.get(READINESS, health.ReadinessEndpoint(healthCheck));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = ({ expressJwt, jwksRsa, config }) => {
|
|
3
|
+
module.exports = ({ expressJwt: { expressjwt: jwt }, jwksRsa, config }) => {
|
|
4
4
|
const { CACHE, RATE_LIMIT, RPM, URI, ALGORITHMS } = config.JWT.AUTH0;
|
|
5
5
|
// Express JWT authentication (Auth0)
|
|
6
6
|
return function handler({ domain, audience, issuer }) {
|
|
7
|
-
return
|
|
7
|
+
return jwt({
|
|
8
8
|
secret: jwksRsa.expressJwtSecret({
|
|
9
9
|
cache: CACHE,
|
|
10
10
|
rateLimit: RATE_LIMIT,
|