mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
17 lines
562 B
TypeScript
17 lines
562 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
|
|
export default async function configHandler(req: NextApiRequest, res: NextApiResponse) {
|
|
// eslint-disable-next-line no-restricted-properties
|
|
const publicEnvs = Object.entries(process.env)
|
|
.filter(([ key ]) => key.startsWith('NEXT_PUBLIC_'))
|
|
.sort(([ keyA ], [ keyB ]) => keyA.localeCompare(keyB))
|
|
.reduce((result, [ key, value ]) => {
|
|
result[key] = value || '';
|
|
return result;
|
|
}, {} as Record<string, string>);
|
|
|
|
res.status(200).json({
|
|
envs: publicEnvs,
|
|
});
|
|
}
|