rack-if 0 ruby Rubygems

Conditionally use Rack apps

5 years after MIT

= Rack::If

Use or don't use rack apps based on a variety of environment variables.

== Use

gem install rackif

Example (in your config.ru):

require 'rackif' use Rack::If do if path == '/protected' && method != 'GET' use Rack::Auth::Basic, "Rack::If Example" do |username, password| 'secret' == password end end end

run MyApp.new # when above matches, this is protected

== Configuration

Rack::If block Shortcut methods for path, method, user_agent, host, port, query_string, http_accept, and http_accept_encoding are available, anything else is available at env.

Example:

use Rack::If do unless env['rack.session']['verified_identity'] use EasyRackOpenID end end

== Copyright

Copyright (c) 2009 Sam Schenkman-Moore, David Dollar. See LICENSE for details.

Related Repositories

rack-attack

rack-attack

Rack middleware for blocking & throttling ...

rack-mini-profiler

rack-mini-profiler

Profiler for your development and production Ruby rack apps. ...

rack-ssl-enforcer

rack-ssl-enforcer

A simple Rack middleware to enforce ssl connections ...

jruby-rack

jruby-rack

Rack for JRuby and Java appservers ...

rack-oauth2-server

rack-oauth2-server

LOOKING FOR MAINTAINER — OAuth 2.0 Authorization Server as a Rack module ...


Top Contributors

samsm

Releases

-   v0.1.2 zip tar