feat: extend k3s artifact consumers
This commit is contained in:
@@ -89,6 +89,10 @@ const rootRealPath = resolveRealWorkspaceRoot(workspaceRoot);
|
||||
const maxFiles = envNumber("MDTODO_MAX_FILES", 250);
|
||||
const recentLogs: JsonRecord[] = [];
|
||||
const logFile = envString("LOG_FILE", envString("MDTODO_LOG_FILE", "/var/log/unidesk/mdtodo.jsonl"));
|
||||
const deployServiceId = envString("UNIDESK_DEPLOY_SERVICE_ID", "mdtodo");
|
||||
const deployRepo = envString("UNIDESK_DEPLOY_REPO", "");
|
||||
const deployCommit = envString("UNIDESK_DEPLOY_COMMIT", "");
|
||||
const deployRequestedCommit = envString("UNIDESK_DEPLOY_REQUESTED_COMMIT", deployCommit);
|
||||
const logWriter = logFile
|
||||
? createHourlyJsonlWriter({
|
||||
baseLogFile: logFile,
|
||||
@@ -592,6 +596,12 @@ function healthSnapshot(): { body: JsonRecord; status: number } {
|
||||
ok: healthy,
|
||||
service: "mdtodo",
|
||||
startedAt,
|
||||
deploy: {
|
||||
serviceId: deployServiceId,
|
||||
repo: deployRepo,
|
||||
commit: deployCommit,
|
||||
requestedCommit: deployRequestedCommit,
|
||||
},
|
||||
rootDir: workspaceRoot,
|
||||
rootExists,
|
||||
writable,
|
||||
@@ -622,7 +632,17 @@ async function route(req: Request): Promise<Response> {
|
||||
const health = healthSnapshot();
|
||||
return jsonResponse(health.body, health.status);
|
||||
}
|
||||
if (url.pathname === "/live") return jsonResponse({ ok: true, service: "mdtodo", startedAt });
|
||||
if (url.pathname === "/live") return jsonResponse({
|
||||
ok: true,
|
||||
service: "mdtodo",
|
||||
startedAt,
|
||||
deploy: {
|
||||
serviceId: deployServiceId,
|
||||
repo: deployRepo,
|
||||
commit: deployCommit,
|
||||
requestedCommit: deployRequestedCommit,
|
||||
},
|
||||
});
|
||||
if (url.pathname === "/logs" && req.method === "GET") return jsonResponse({ ok: true, logs: recentLogs.slice(-100) });
|
||||
if (url.pathname === "/api/files" && req.method === "GET") return jsonResponse({ ok: true, rootDir: workspaceRoot, files: listTodoFiles() });
|
||||
if (url.pathname === "/api/content" && req.method === "GET") {
|
||||
|
||||
Reference in New Issue
Block a user