Giter VIP home page Giter VIP logo

serverless-plugin-conditional-functions's Introduction

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

serverless-plugin-conditional-functions's People

Contributors

adam-skalicky avatar dependabot[bot] avatar go-dima avatar wesdunn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.