mirror of
https://github.com/Lissy93/web-check.git
synced 2025-06-02 00:15:39 +02: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;
|
// The format of the handlers varies between platforms
|
||||||
if (process.env.PLATFORM === 'vercel' || process.env.VERCEL) {
|
// E.g. Netlify + AWS expect Lambda functions, but Vercel or Node needs standard handler
|
||||||
platform = 'vercel';
|
const platformEnv = (process.env.PLATFORM || '').toUpperCase(); // Has user set platform manually?
|
||||||
} else {
|
|
||||||
platform = 'netlify';
|
const nativeMode = (['VERCEL', 'NODE'].includes(platformEnv) || process.env.VERCEL || process.env.WC_SERVER);
|
||||||
}
|
|
||||||
return platform === 'vercel' ? vercelHandler : netlifyHandler;
|
return nativeMode ? vercelHandler : netlifyHandler;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = commonMiddleware;
|
module.exports = commonMiddleware;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user