mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
Merge pull request #1987 from blockscout/tom2drum/issue-1964
Add endpoint what will return the list of app ENVs
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user