Adding the version to the status to help understand what version the service is using.

This commit is contained in:
mike12345567 2024-06-10 18:56:24 +01:00
parent 2c83363d25
commit 3a95aa6aeb
3 changed files with 27 additions and 7 deletions

View File

@ -1 +1,2 @@
export * from "./environment" export * from "./environment"
export * from "./status"

View File

@ -0,0 +1,11 @@
export type SystemStatusResponse = {
passing?: boolean
checks?: {
login: boolean
search: boolean
}
health?: {
passing: boolean
}
version?: string
}

View File

@ -1,16 +1,24 @@
import { accounts } from "@budibase/backend-core" import { accounts, env as coreEnv } from "@budibase/backend-core"
import { Ctx, SystemStatusResponse } from "@budibase/types"
import env from "../../../environment" import env from "../../../environment"
import { BBContext } from "@budibase/types"
export const fetch = async (ctx: BBContext) => { export const fetch = async (ctx: Ctx<void, SystemStatusResponse>) => {
let status: SystemStatusResponse | undefined
if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) { if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) {
const status = await accounts.getStatus() status = await accounts.getStatus()
ctx.body = status }
} else {
ctx.body = { if (!status) {
status = {
health: { health: {
passing: true, passing: true,
}, },
} }
} }
if (coreEnv.VERSION) {
status.version = coreEnv.VERSION
}
ctx.body = status
} }