Adding the version to the status to help understand what version the service is using.
This commit is contained in:
parent
2c83363d25
commit
3a95aa6aeb
|
@ -1 +1,2 @@
|
||||||
export * from "./environment"
|
export * from "./environment"
|
||||||
|
export * from "./status"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
export type SystemStatusResponse = {
|
||||||
|
passing?: boolean
|
||||||
|
checks?: {
|
||||||
|
login: boolean
|
||||||
|
search: boolean
|
||||||
|
}
|
||||||
|
health?: {
|
||||||
|
passing: boolean
|
||||||
|
}
|
||||||
|
version?: string
|
||||||
|
}
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue