mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
New feature — adds a platform-only API endpoint to Studio.
## What is the current behavior?
`NEXT_PUBLIC_ONGOING_INCIDENT` is not exposed outside of the dashboard.
## What is the new behavior?
`GET /api/status-override` returns `{ enabled: boolean }` indicating
whether `NEXT_PUBLIC_ONGOING_INCIDENT` is set to `"true"`. The endpoint
returns 404 on self-hosted and is added to the proxy allowlist for
hosted platform access.
This is so that the incident banner bot can detect whether an override
is in place.
20 lines
495 B
TypeScript
20 lines
495 B
TypeScript
import { IS_PLATFORM } from 'common'
|
|
import { NextApiRequest, NextApiResponse } from 'next'
|
|
|
|
type ResponseData = { enabled: boolean }
|
|
|
|
export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
|
if (!IS_PLATFORM) {
|
|
return res.status(404).end()
|
|
}
|
|
|
|
if (req.method !== 'GET') {
|
|
res.setHeader('Allow', ['GET'])
|
|
return res.status(405).end()
|
|
}
|
|
|
|
return res.status(200).json({
|
|
enabled: process.env.NEXT_PUBLIC_ONGOING_INCIDENT === 'true',
|
|
})
|
|
}
|