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

airfoil

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airfoil

  • 0.1.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Airfoil

Enough structure to get our Lambda handlers in the air.

Airfoil is curated middleware stack that abstracts away common infrastructure needed for Lambda handler functions.

Installation

Add this line to your application's Gemfile:

gem 'airfoil'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install airfoil

Usage

You can instantiate a new handler with an Airfoil stack like so:

require_relative "config/environment"

STACK = Airfoil.create_stack do |b|
  # Custom middleware and handlers go here
  b.use Airfoil::Middleware::FunctionName, DbReset, "db-reset"
  b.use Airfoil::Middleware::FunctionName, UpdateUpcomingRenewals, "update-upcoming-renewals"
end

def handler(event:, context:)
  STACK.call({event: event, context: context})
end

Airfoil also includes a stack of middleware that you can add to or customize to suit your specific needs. Your own middleware can inherit from the base class and implement their own behavior like so:

class MyResolverMiddleware < Airfoil::Middleware::Base
  def call(env)
    ApplicationResolver.handle(env[:event], env[:context])
  end
end

Existing middleware include:

  • FunctionName - dispatch any calls made to a specific Lambda function (by name) to a specified handler class
  • LogEvent - log AWS events in a pretty format
  • SetRequestId - set the AWS_REQUEST_ID environment variable for your function code

Additional Middleware

There are additional middleware available as separate gems that provide specific functionality. They must be explicitly added to your middleware stack in create_stack.

Sentry

Add the airfoil-sentry gem to your Gemfile.This provides three middlewares:

  • SentryCatcher - catch exceptions and report them to Sentry, including context:
b.use Airfoil::Middleware::SentryCatcher
  • SentryMonitoring - instrument your function code for Sentry's performance monitoring
b.use Airfoil::Middleware::SentryMonitoring

Datadog

Add the airfoil-datadog gem to your Gemfile. This provides a single middleware:

  • Datadog - wire up the Datadog Lambda SDK and report traces to it
b.use Airfoil::Middleware::Datadog

ActiveRecord

Add the airfoil-activerecord gem to your Gemfile. This provides a single middleware:

  • DatabaseConnection - Check a connection in/out and enable the query cache per handler
b.use Airfoil::Middleware::DatabaseConnection

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

FAQs

Package last updated on 20 Aug 2024

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