mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 07:39:07 +03:00
* Deprecate getAPIKeys from project settings v2, use new api keys endpoint instead * use getPreferredKeys where appropriate * Prevent usage of secret key for storage and realtime inspector * Add dashboard API api-keys endpoint * Simplify * Disable edge functions test if legacy api keys are disabled * Revert * Fix graphiql * Remove all usage of api keys from project settings, except DisplayApiSettings * Update * Fix * Small fix for an undefined upload url. * Fix the storage state initialization when the resumable url changes. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { NextApiRequest, NextApiResponse } from 'next'
|
|
|
|
import { components } from 'api-types'
|
|
import apiWrapper from 'lib/api/apiWrapper'
|
|
|
|
type ProjectAppConfig = components['schemas']['ProjectSettingsResponse']['app_config'] & {
|
|
protocol?: string
|
|
}
|
|
export type ProjectSettings = components['schemas']['ProjectSettingsResponse'] & {
|
|
app_config?: ProjectAppConfig
|
|
}
|
|
|
|
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
|
|
|
|
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const { method } = req
|
|
|
|
switch (method) {
|
|
case 'GET':
|
|
return handleGetAll(req, res)
|
|
default:
|
|
res.setHeader('Allow', ['GET'])
|
|
res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
|
|
}
|
|
}
|
|
|
|
const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
const response = [
|
|
{
|
|
name: 'anon',
|
|
api_key: process.env.SUPABASE_ANON_KEY ?? '',
|
|
id: 'anon',
|
|
type: 'legacy',
|
|
hash: '',
|
|
prefix: '',
|
|
description: 'Legacy anon API key',
|
|
},
|
|
{
|
|
name: 'service_role',
|
|
api_key: process.env.SUPABASE_SERVICE_KEY ?? '',
|
|
id: 'service_role',
|
|
type: 'legacy',
|
|
hash: '',
|
|
prefix: '',
|
|
description: 'Legacy service_role API key',
|
|
},
|
|
]
|
|
|
|
return res.status(200).json(response)
|
|
}
|