Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including serverless-plugin-stage-variables with all npm packages installed. Try it out:

var serverlessPluginStageVariables = require("serverless-plugin-stage-variables")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

serverless-plugin-stage-variables v1.9.2

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
}
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free