mirror of
https://codeberg.org/alicia/web-check.git
synced 2026-03-14 14:45:48 +01:00
Update the env check, to determine what handler format to use
This commit is contained in:
parent
63db1dbd85
commit
59203acdfa
1 changed files with 7 additions and 8 deletions
|
|
@ -70,14 +70,13 @@ const commonMiddleware = (handler) => {
|
|||
}
|
||||
};
|
||||
|
||||
let platform;
|
||||
if (process.env.PLATFORM === 'vercel' || process.env.VERCEL) {
|
||||
platform = 'vercel';
|
||||
} else {
|
||||
platform = 'netlify';
|
||||
}
|
||||
return platform === 'vercel' ? vercelHandler : netlifyHandler;
|
||||
|
||||
// The format of the handlers varies between platforms
|
||||
// E.g. Netlify + AWS expect Lambda functions, but Vercel or Node needs standard handler
|
||||
const platformEnv = (process.env.PLATFORM || '').toUpperCase(); // Has user set platform manually?
|
||||
|
||||
const nativeMode = (['VERCEL', 'NODE'].includes(platformEnv) || process.env.VERCEL || process.env.WC_SERVER);
|
||||
|
||||
return nativeMode ? vercelHandler : netlifyHandler;
|
||||
};
|
||||
|
||||
module.exports = commonMiddleware;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue