Merge pull request #13906 from Budibase/fix/status-with-version
Adding version to system status call
This commit is contained in:
commit
7d28dbd4c8
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ describe("/api/system/status", () => {
|
||||||
health: {
|
health: {
|
||||||
passing: true,
|
passing: true,
|
||||||
},
|
},
|
||||||
|
version: expect.any(String),
|
||||||
})
|
})
|
||||||
expect(accounts.getStatus).toHaveBeenCalledTimes(0)
|
expect(accounts.getStatus).toHaveBeenCalledTimes(0)
|
||||||
config.cloudHosted()
|
config.cloudHosted()
|
||||||
|
|
Loading…
Reference in New Issue