mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat: add version to startup logs
This commit is contained in:
@@ -17,9 +17,11 @@ import { startJobs } from './job/schedule';
|
|||||||
import notificationManager from './lib/notifications';
|
import notificationManager from './lib/notifications';
|
||||||
import DiscordAgent from './lib/notifications/agents/discord';
|
import DiscordAgent from './lib/notifications/agents/discord';
|
||||||
import EmailAgent from './lib/notifications/agents/email';
|
import EmailAgent from './lib/notifications/agents/email';
|
||||||
|
import { getAppVersion } from './utils/appVersion';
|
||||||
|
|
||||||
const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml');
|
const API_SPEC_PATH = path.join(__dirname, '../overseerr-api.yml');
|
||||||
|
|
||||||
|
logger.info(`Starting Overseerr version ${getAppVersion()}`);
|
||||||
const dev = process.env.NODE_ENV !== 'production';
|
const dev = process.env.NODE_ENV !== 'production';
|
||||||
const app = next({ dev });
|
const app = next({ dev });
|
||||||
const handle = app.getRequestHandler();
|
const handle = app.getRequestHandler();
|
||||||
@@ -101,7 +103,7 @@ app
|
|||||||
const port = Number(process.env.PORT) || 3000;
|
const port = Number(process.env.PORT) || 3000;
|
||||||
server.listen(port, () => {
|
server.listen(port, () => {
|
||||||
logger.info(`Server ready on port ${port}`, {
|
logger.info(`Server ready on port ${port}`, {
|
||||||
label: 'SERVER',
|
label: 'Server',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@@ -19,6 +19,7 @@ import { isAuthenticated } from '../middleware/auth';
|
|||||||
import { merge } from 'lodash';
|
import { merge } from 'lodash';
|
||||||
import Media from '../entity/Media';
|
import Media from '../entity/Media';
|
||||||
import { MediaRequest } from '../entity/MediaRequest';
|
import { MediaRequest } from '../entity/MediaRequest';
|
||||||
|
import { getAppVersion } from '../utils/appVersion';
|
||||||
|
|
||||||
const settingsRoutes = Router();
|
const settingsRoutes = Router();
|
||||||
|
|
||||||
@@ -445,16 +446,8 @@ settingsRoutes.get('/about', async (req, res) => {
|
|||||||
const totalMediaItems = await mediaRepository.count();
|
const totalMediaItems = await mediaRepository.count();
|
||||||
const totalRequests = await mediaRequestRepository.count();
|
const totalRequests = await mediaRequestRepository.count();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
const { version } = require('../../package.json');
|
|
||||||
|
|
||||||
let finalVersion = version;
|
|
||||||
|
|
||||||
if (version === '0.1.0') {
|
|
||||||
finalVersion = `develop-${process.env.COMMIT_TAG ?? 'local'}`;
|
|
||||||
}
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
version: finalVersion,
|
version: getAppVersion(),
|
||||||
totalMediaItems,
|
totalMediaItems,
|
||||||
totalRequests,
|
totalRequests,
|
||||||
});
|
});
|
||||||
|
12
server/utils/appVersion.ts
Normal file
12
server/utils/appVersion.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export const getAppVersion = (): string => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
const { version } = require('../../package.json');
|
||||||
|
|
||||||
|
let finalVersion = version;
|
||||||
|
|
||||||
|
if (version === '0.1.0') {
|
||||||
|
finalVersion = `develop-${process.env.COMMIT_TAG ?? 'local'}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalVersion;
|
||||||
|
};
|
Reference in New Issue
Block a user