mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix: use new commit tag file for app version as well
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Router } from 'express';
|
||||
import path from 'path';
|
||||
import user from './user';
|
||||
import authRoutes from './auth';
|
||||
import { checkUser, isAuthenticated } from '../middleware/auth';
|
||||
@@ -14,18 +13,7 @@ import tvRoutes from './tv';
|
||||
import mediaRoutes from './media';
|
||||
import personRoutes from './person';
|
||||
import collectionRoutes from './collection';
|
||||
import { getAppVersion } from '../utils/appVersion';
|
||||
import { existsSync } from 'fs';
|
||||
import logger from '../logger';
|
||||
|
||||
const COMMIT_TAG_PATH = path.join(__dirname, '../../committag.json');
|
||||
let commitTag = 'local';
|
||||
|
||||
if (existsSync(COMMIT_TAG_PATH)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
commitTag = require(COMMIT_TAG_PATH).commitTag;
|
||||
logger.info(`Commit Tag: ${commitTag}`);
|
||||
}
|
||||
import { getAppVersion, getCommitTag } from '../utils/appVersion';
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -34,7 +22,7 @@ router.use(checkUser);
|
||||
router.get('/status', (req, res) => {
|
||||
return res.status(200).json({
|
||||
version: getAppVersion(),
|
||||
commitTag,
|
||||
commitTag: getCommitTag(),
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -1,3 +1,20 @@
|
||||
import { existsSync } from 'fs';
|
||||
import path from 'path';
|
||||
import logger from '../logger';
|
||||
|
||||
const COMMIT_TAG_PATH = path.join(__dirname, '../../committag.json');
|
||||
let commitTag = 'local';
|
||||
|
||||
if (existsSync(COMMIT_TAG_PATH)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
commitTag = require(COMMIT_TAG_PATH).commitTag;
|
||||
logger.info(`Commit Tag: ${commitTag}`);
|
||||
}
|
||||
|
||||
export const getCommitTag = (): string => {
|
||||
return commitTag;
|
||||
};
|
||||
|
||||
export const getAppVersion = (): string => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { version } = require('../../package.json');
|
||||
@@ -5,7 +22,7 @@ export const getAppVersion = (): string => {
|
||||
let finalVersion = version;
|
||||
|
||||
if (version === '0.1.0') {
|
||||
finalVersion = `develop-${process.env.COMMIT_TAG ?? 'local'}`;
|
||||
finalVersion = `develop-${getCommitTag()}`;
|
||||
}
|
||||
|
||||
return finalVersion;
|
||||
|
Reference in New Issue
Block a user