-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
31 lines (24 loc) · 889 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const express = require('express');
const app = express();
const jose = require('node-jose');
const fs = require('fs');
const health = require('@cloudnative/health-connect');
let healthcheck = new health.HealthChecker();
const shutdownPromise = () => new Promise(function (resolve, _reject) {
setTimeout(function () {
console.log('DONE!');
resolve();
}, 10);
});
let shutdownCheck = new health.ShutdownCheck("shutdownCheck", shutdownPromise);
healthcheck.registerShutdownCheck(shutdownCheck);
app.use('/live', health.LivenessEndpoint(healthcheck));
app.use('/ready', health.ReadinessEndpoint(healthcheck));
(async () => {
const ks = fs.readFileSync('config/secret.json');
const keyStore = await jose.JWK.asKeyStore(ks.toString());
app.get('/jwks', function (req, res) {
res.json(keyStore.toJSON());
});
app.listen(3000);
})();