Sha256: 9cdaff66e300dd75c4749aa4c32c6f4f881d75547b215e43eab98225666062c7

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

require 'rubygems'
require 'sinatra'
require 'rackamole'


configure do
  set :sessions, true
  
puts "mole_sinatra_#{Sinatra::Application.environment}_mdb"

  use Rack::Lint
  use Rack::Session::Cookie
  use Rack::Mole, { 
    :app_name       => "Franky",
    :environment    => Sinatra::Application.environment,
    :log_level      => :debug,
    :user_key       => :user_name,
    :store          => Rackamole::Store::MongoDb.new( 
      :host     => 'ec2-174-129-88-130.compute-1.amazonaws.com', 
      :database => "mole_franky_#{Sinatra::Application.environment}_mdb" ),
    # :store          => Rackamole::Store::MongoDb.new( :database => "mole_franky_#{Sinatra::Application.environment}_mdb" ),
    :expiration     => 10,
    :perf_threshold => 0.2,
    # :twitter        => { :username => 'moled', :password => 'fernand~1', :alert_on => [Rackamole.perf, Rackamole.fault] },
    :excluded_paths => [ /.+?\.css/, /.+?\.js/, /.+?\.png/, /.+?\.ico/ ]
  }
end

before do
  session[:user_name] = "Fernand"
end

get '/' do
  erb :index
end

get '/normal' do  
  @blee          = "Hello World!"
  session[:normal] = "something normal"
  erb :normal
end

post '/post' do
  @post = params[:blee]
  session[:post] = "something posted"  
  erb :post
end

get '/params/:id' do  
  @blee          = params[:id]
  session[:param] = "something param"
  
  erb :params
end

get '/error' do
  raise "Oh Snap!"
end

get '/slow' do
  sleep 0.2
  erb :slow
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rackamole-0.2.5 samples/sinatra/moled.rb
rackamole-0.2.4 samples/sinatra/moled.rb
rackamole-0.2.3 samples/sinatra/moled.rb
rackamole-0.2.2 samples/sinatra/moled.rb
rackamole-0.2.1 samples/sinatra/moled.rb
rackamole-0.2.0 samples/sinatra/moled.rb