Skip to content

Commit 5e56d94

Browse files
committed
Added AWS_SAM_LOCAL=true environment variable, so customers can detect in their Lambda function whether the function is running locally or not. Fixes #6
1 parent 79e85a3 commit 5e56d94

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

runtime.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import (
1616
"fmt"
1717
"path"
1818

19+
"os/signal"
20+
"syscall"
21+
1922
"github.com/aws/aws-sdk-go/aws/session"
2023
"github.com/awslabs/goformation/resources"
2124
"github.com/docker/docker/api/types"
@@ -30,8 +33,6 @@ import (
3033
"github.com/imdario/mergo"
3134
"github.com/mattn/go-colorable"
3235
"github.com/pkg/errors"
33-
"os/signal"
34-
"syscall"
3536
)
3637

3738
// Invoker is a simple interface to help with testing runtimes
@@ -452,6 +453,7 @@ func getEnvironmentVariables(function resources.AWSServerlessFunction, overrides
452453

453454
// Variables available in Lambda execution environment for all functions (AWS_* variables)
454455
env := map[string]string{
456+
"AWS_SAM_LOCAL": "true",
455457
"AWS_DEFAULT_REGION": creds["region"],
456458
"AWS_ACCESS_KEY_ID": creds["key"],
457459
"AWS_SECRET_ACCESS_KEY": creds["secret"],

0 commit comments

Comments
 (0)