1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00

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 "./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 { 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) {
const status = await accounts.getStatus()
ctx.body = status
} else {
ctx.body = {
status = await accounts.getStatus()
}
if (!status) {
status = {
health: {
passing: true,
},
}
}
if (coreEnv.VERSION) {
status.version = coreEnv.VERSION
}
ctx.body = status
}