mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-23 12:05:27 +08:00
feat(ql3): prove legacy rollback readiness
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const http = require('node:http');
|
||||
|
||||
const port = Number(process.argv[2]);
|
||||
if (!Number.isSafeInteger(port) || port < 1 || port > 65_535) {
|
||||
process.stderr.write('legacy live service port is invalid\n');
|
||||
process.exit(64);
|
||||
}
|
||||
|
||||
const server = http.createServer((request, response) => {
|
||||
if (request.method !== 'GET' || request.url !== '/api/system') {
|
||||
response.writeHead(404, { connection: 'close' });
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
const body = JSON.stringify({
|
||||
code: 200,
|
||||
data: {
|
||||
isInitialized: true,
|
||||
version: '2.21.0',
|
||||
publishTime: 1_787_200_000,
|
||||
branch: 'next-live-gate',
|
||||
changeLog: '',
|
||||
changeLogLink: '',
|
||||
},
|
||||
});
|
||||
response.writeHead(200, {
|
||||
'content-type': 'application/json',
|
||||
'content-length': Buffer.byteLength(body),
|
||||
connection: 'close',
|
||||
});
|
||||
response.end(body);
|
||||
});
|
||||
|
||||
function shutdown() {
|
||||
server.close(() => process.exit(0));
|
||||
}
|
||||
|
||||
process.on('SIGINT', shutdown);
|
||||
process.on('SIGTERM', shutdown);
|
||||
server.listen(port, '127.0.0.1');
|
||||
Reference in New Issue
Block a user