mirror of
https://github.com/immich-app/immich.git
synced 2025-12-25 17:24:58 +03:00
* add healthcheck * format, import, IMMICH_PORT, and eslint change * chore: clean up nodejs healthcheck * fix ruff formating * add healthcheck * format, import, IMMICH_PORT, and eslint change * chore: clean up nodejs healthcheck * fix ruff formating * add healthcheck to dockerfile * poetry run ruff check --fix * removed 2 of 3 console calls --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
30 lines
663 B
JavaScript
30 lines
663 B
JavaScript
#!/usr/bin/env node
|
|
const port = Number(process.env.IMMICH_PORT) || 3001;
|
|
const controller = new AbortController();
|
|
|
|
const main = async () => {
|
|
const timeout = setTimeout(() => controller.abort(), 2000);
|
|
try {
|
|
const response = await fetch(`http://localhost:${port}/api/server-info/ping`, {
|
|
signal: controller.signal,
|
|
});
|
|
|
|
if (response.ok) {
|
|
const body = await response.json();
|
|
if (body.res === 'pong') {
|
|
process.exit();
|
|
}
|
|
}
|
|
} catch (error) {
|
|
if (error instanceof DOMException === false) {
|
|
console.error(error);
|
|
}
|
|
} finally {
|
|
clearTimeout(timeout);
|
|
}
|
|
|
|
process.exit(1);
|
|
};
|
|
|
|
void main();
|