improve /version api route to only call git once on startup
This commit is contained in:
parent
45a4935190
commit
a79a1eab81
@ -67,6 +67,10 @@ Sentry.init({
|
||||
environment: config.global.debug ? 'development' : 'production'
|
||||
});
|
||||
|
||||
app.locals.versionRev = require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString().trim()
|
||||
|
||||
// RequestHandler creates a separate execution context using domains, so that every
|
||||
// transaction/span/breadcrumb is attached to its own Hub instance
|
||||
app.use(Sentry.Handlers.requestHandler());
|
||||
|
@ -1,9 +1,7 @@
|
||||
import express, { Request, Response } from 'express';
|
||||
|
||||
function get(req: Request, res: Response) {
|
||||
const revision = require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString().trim()
|
||||
const revision = req.app.locals.versionRev;
|
||||
res.status(200).send({ version: '1.0.0', commit: revision });
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user