add netlify env check
This commit is contained in:
parent
b1810b4165
commit
7c333430bd
|
|
@ -19,7 +19,9 @@ export const isValidUrl = (input: string) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the running instance is inside an AWS Lambda container.
|
* Determines if the running instance is inside an AWS Lambda container.
|
||||||
* @returns
|
* AWS_EXECUTION_ENV is for native Lambda instances
|
||||||
|
* AWS_LAMBDA_JS_RUNTIME is for netlify instances
|
||||||
|
* @returns boolean indicating if the running instance is inside a Lambda container
|
||||||
*/
|
*/
|
||||||
export const isRunningInAwsLambda = () => {
|
export const isRunningInAwsLambda = () => {
|
||||||
if (
|
if (
|
||||||
|
|
@ -27,6 +29,11 @@ export const isRunningInAwsLambda = () => {
|
||||||
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
|
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (
|
||||||
|
process.env["AWS_LAMBDA_JS_RUNTIME"] &&
|
||||||
|
/^nodejs/.test(process.env["AWS_LAMBDA_JS_RUNTIME"]) === true
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue