Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lambda native env vars #549

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion zappa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ def deploy(self):
description=self.lambda_description,
vpc_config=self.vpc_config,
timeout=self.timeout_seconds,
memory_size=self.memory_size)
memory_size=self.memory_size,
environment_variables=self.environment_variables)

# Schedule events for this deployment
self.schedule()
Expand Down
3 changes: 3 additions & 0 deletions zappa/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def create_wsgi_request(event_info, server_name='zappa', script_name=None,
if remote_user:
environ['REMOTE_USER'] = remote_user

if event_info['requestContext'].get('authorizer'):
environ['API_GATEWAY_AUTHORIZER'] = event_info['requestContext']['authorizer']

return environ


Expand Down
9 changes: 7 additions & 2 deletions zappa/zappa.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,14 @@ def remove_from_s3(self, file_name, bucket_name):
##

def create_lambda_function(self, bucket, s3_key, function_name, handler, description="Zappa Deployment",
timeout=30, memory_size=512, publish=True, vpc_config=None):
timeout=30, memory_size=512, publish=True, vpc_config=None, environment_variables=None):
"""
Given a bucket and key of a valid Lambda-zip, a function name and a handler, register that Lambda function.
"""
if not vpc_config:
vpc_config = {}
if not environment_variables:
environment_variables = {}
if not self.credentials_arn:
self.get_credentials_arn()

Expand All @@ -648,7 +650,10 @@ def create_lambda_function(self, bucket, s3_key, function_name, handler, descrip
Timeout=timeout,
MemorySize=memory_size,
Publish=publish,
VpcConfig=vpc_config
VpcConfig=vpc_config,
Environment={
'Variables': environment_variables
}
)

return response['FunctionArn']
Expand Down