mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
refactor: move system health procedure from system to admin router
- Rename `system.health` → `admin.systemHealth` and gate it behind the admin middleware - Remove `tmdbConfigured` from `system.status` response; update description to reflect its purpose - Update all call sites on web and native to use `orpc.admin.systemHealth` - Rename and relocate the docs page from `system/system.health.mdx` to `admin/admin.systemHealth.mdx`
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
purgeMetadataCache as purgeMetadataFn,
|
||||
} from "@sofa/core/cache";
|
||||
import { getSetting, setSetting } from "@sofa/core/settings";
|
||||
import { getSystemHealth } from "@sofa/core/system-health";
|
||||
import { isTelemetryEnabled } from "@sofa/core/telemetry";
|
||||
import {
|
||||
getCachedUpdateCheck,
|
||||
@@ -173,3 +174,11 @@ export const purgeMetadataCache = os.admin.purgeMetadataCache
|
||||
export const purgeImageCache = os.admin.purgeImageCache
|
||||
.use(admin)
|
||||
.handler(async () => purgeImagesFn());
|
||||
|
||||
// ─── System Health ───────────────────────────────────────────────
|
||||
|
||||
export const systemHealth = os.admin.systemHealth
|
||||
.use(admin)
|
||||
.handler(async () => {
|
||||
return await getSystemHealth();
|
||||
});
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
import { getSystemHealth } from "@sofa/core/system-health";
|
||||
import { isTmdbConfigured } from "@sofa/tmdb/config";
|
||||
import { os } from "../context";
|
||||
import { admin, authed } from "../middleware";
|
||||
import { authed } from "../middleware";
|
||||
|
||||
export const status = os.system.status.use(authed).handler(() => {
|
||||
return {
|
||||
tmdbConfigured: isTmdbConfigured(),
|
||||
publicApiUrl: process.env.PUBLIC_API_URL || "https://public-api.sofa.watch",
|
||||
};
|
||||
});
|
||||
|
||||
export const health = os.system.health.use(admin).handler(async () => {
|
||||
return await getSystemHealth();
|
||||
});
|
||||
|
||||
@@ -55,7 +55,6 @@ export const implementedRouter = {
|
||||
publicInfo: system.publicInfo,
|
||||
authConfig: system.authConfig,
|
||||
status: status.status,
|
||||
health: status.health,
|
||||
},
|
||||
integrations: {
|
||||
list: integrations.list,
|
||||
@@ -81,6 +80,7 @@ export const implementedRouter = {
|
||||
triggerJob: admin.triggerJob,
|
||||
purgeMetadataCache: admin.purgeMetadataCache,
|
||||
purgeImageCache: admin.purgeImageCache,
|
||||
systemHealth: admin.systemHealth,
|
||||
},
|
||||
account: {
|
||||
updateName: account.updateName,
|
||||
|
||||
Reference in New Issue
Block a user