feat: extract shop from mp/shop — initial libreshop/shop
Some checks failed
Build and publish / build (push) Failing after 19s

Source moved verbatim from mp/shop/ on 2026-04-29; mp was the first
concrete adapter consuming the libreshop toolkit. Builds and publishes
git.librete.ch/libreshop/shop on every main / v* push via the standard
.gitea/workflows/build.yml shared across libreshop components.
This commit is contained in:
Michael Czechowski
2026-04-29 17:48:56 +02:00
commit 44107c0734
134 changed files with 19521 additions and 0 deletions

26
server/api/health.get.ts Normal file
View File

@@ -0,0 +1,26 @@
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig();
const healthStatus: Record<string, unknown> = { status: "ok" };
// Check CMS connectivity (CMS returns 204 No Content for /_health)
try {
const cmsUrl = config.cmsInternalUrl || "http://cms:5555";
await $fetch(`${cmsUrl}/_health`, {
timeout: 5000,
ignoreResponseError: false
});
// If we get here without error, CMS is responding (even with 204)
healthStatus.cms_responding = true;
} catch (error) {
healthStatus.cms_responding = false;
healthStatus.status = "degraded";
}
// Check if API token is configured
healthStatus.api_token_configured = !!config.shopApiToken;
const statusCode = healthStatus.status === "ok" ? 200 : 503;
setResponseStatus(event, statusCode);
return healthStatus;
});