aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.63k stars 1.01k forks source link

Q: Is it possible to configure API Gateway stage variables? #728

Open ottokruse opened 6 years ago

ottokruse commented 6 years ago

Is it possible to configure API Gateway stage variables? E.g. set them up in the config.json and have them set up in API Gateway upon "chalice deploy"?

Context: we use a lambda authorizer that use stage variables.

kadrach commented 6 years ago

I don't think this is possible directly, Chalice uses Lambda environment variables.

If you use the CloudFormation deployer you can modify the generated SAM template before deployment. I right-merge a custom config file on top of it for stage variables. It's a hack, but it works :)

ottokruse commented 6 years ago

Aw that is too bad! Thanks for the tip though.

However is this something that could/should someday (soon) be possible in Chalice. Or is it "by design" that everything works with lambda environment variables instead of api gateway stage variables?

I would like to re-use my Authorizer lambda function in multiple API Gateway API's. I don't see another way of passing configuration to the authorizer other than through stage variables

stealthycoin commented 6 years ago

I can see how this would be useful. Adding this as a feature request.

wutachih commented 6 years ago

So if we want to use custom domain, we will have to do it from console or cli.