serverless-plugin-stage-variables

v1.10.1
Plugin for the SLS 1.x that adds stage variables to apigateway

serverless-plugin-stage-variables

Add stage variables for Serverless 1.x to ApiGateway, so you can use variables (and CloudFormation references!) in your Lambda's.

Usage


custom:
  stageVariables:
    bucket_name: ${env.BUCKET_NAME}
    endpoint: { "Fn::GetAtt": "CloudFrontEndpoint.DomainName" }
    foo: bar

plugins:
  - serverless-plugin-stage-variables

And then in your lambda's, you can use:

module.exports.foobar = (event, context, cb) => {
  // event.stageVariables.bucket_name
  // event.stageVariables.endpoint
  // event.stageVariables.foo
}
npm i serverless-plugin-stage-variables

Source Code

Metadata

  • MIT
  • Whatever
  • Sander van de Graaf
  • released 11/26/2021

Downloads