Add runner ci (test)
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
import { Router } from 'express';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getAllPublicServers } from '../cqrs';
|
||||
import { getReleaseManifestUrl } from '../config/variables';
|
||||
import { SERVER_BUILD_VERSION } from '../generated/build-version';
|
||||
import { connectedUsers } from '../websocket/state';
|
||||
|
||||
const router = Router();
|
||||
|
||||
function getServerProjectVersion(): string {
|
||||
try {
|
||||
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
||||
const rawContents = fs.readFileSync(packageJsonPath, 'utf8');
|
||||
const parsed = JSON.parse(rawContents) as { version?: unknown };
|
||||
|
||||
return typeof parsed.version === 'string' && parsed.version.trim().length > 0
|
||||
? parsed.version.trim()
|
||||
: '0.0.0';
|
||||
} catch {
|
||||
return '0.0.0';
|
||||
}
|
||||
return typeof process.env.METOYOU_SERVER_VERSION === 'string' && process.env.METOYOU_SERVER_VERSION.trim().length > 0
|
||||
? process.env.METOYOU_SERVER_VERSION.trim()
|
||||
: SERVER_BUILD_VERSION;
|
||||
}
|
||||
|
||||
router.get('/health', async (_req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user