Commit 6021ab6d authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #1987 from blockscout/tom2drum/issue-1964

Add endpoint what will return the list of app ENVs
parents 3061166c a5b2f0bf
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,
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment