({ request, params }: LoaderFunctionArgs)
| 9 | import { requireUserWithRole } from '#app/utils/permissions.server.ts' |
| 10 | |
| 11 | export async function loader({ request, params }: LoaderFunctionArgs) { |
| 12 | await requireUserWithRole(request, 'admin') |
| 13 | const searchParams = new URL(request.url).searchParams |
| 14 | const currentInstanceInfo = await getInstanceInfo() |
| 15 | const allInstances = await getAllInstances() |
| 16 | const instance = |
| 17 | searchParams.get('instance') ?? currentInstanceInfo.currentInstance |
| 18 | await ensureInstance(instance) |
| 19 | |
| 20 | const { cacheKey } = params |
| 21 | invariantResponse(cacheKey, 'cacheKey is required') |
| 22 | return json({ |
| 23 | instance: { |
| 24 | hostname: instance, |
| 25 | region: allInstances[instance], |
| 26 | isPrimary: currentInstanceInfo.primaryInstance === instance, |
| 27 | }, |
| 28 | cacheKey, |
| 29 | value: cache.get(cacheKey), |
| 30 | }) |
| 31 | } |
nothing calls this directly
no test coverage detected