mirror of
https://github.com/Lissy93/web-check.git
synced 2025-03-13 14:39:48 +01:00
Update the env check, to determine what handler format to use
This commit is contained in:
parent
63db1dbd85
commit
59203acdfa
@ -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…
Reference in New Issue
Block a user