Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-plugin-conditional-functions

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-plugin-conditional-functions

Allow to enable/disable each function with an expression

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version Build Status npm downloads

NPM

Serverless Plugin Conditional Functions

This plugin allows you to add a custom condition to each function in your serverless.yml, to toggle the deployment of your functions. Effectively, it allows a simple feature-flag per function.

For example, if you want to deploy a function for testing only, but don't want it in production, or vice-versa. The attribute supports simple true/false usage or more complex (see below) conditions.

Installation

npm i serverless-plugin-conditional-functions --save-dev

Example

service: MyCustomService
provider:
  name: aws
  runtime: java8
  stage: ${opt:stage,'test'}
  region: ${opt:region,'us-east-1'}

plugins:
  - serverless-plugin-conditional-functions

functions:
  func1:
    enabled: '"${self:provider.stage}" == "prod"'
    handler: com.example.functions.Func1Handler
    events:
      - http:
          path: func1
          method: GET
          integration: lambda
  func2:
    enabled: '"${self:provider.stage}" != "prod"'
    handler: com.example.functions.Func2Handler
    events:
      - http:
          path: func2
          method: GET
          integration: lambda
  func3:
    enabled: 'false'
    handler: com.example.functions.Func3Handler
    events:
      - http:
          path: func3
          method: GET
          integration: lambda

Keywords

FAQs

Package last updated on 01 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc