Sha256: 407ba99e4f7b1f51b336473bb64d5231ffefedbc82985c9c6d73ef8294b7f28f
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
import 'http_log' environment(:development) do config['api_auth_db'] = EventMachine::Synchrony::ConnectionPool.new(:size => 20) do conn = EM::Mongo::Connection.new('localhost', 27017, 1, {:reconnect_in => 1}) conn.db('buzzkill_test') end # for demo purposes, some dummy accounts timebin = ((Time.now.to_i / 3600).floor * 3600) # This user's calls should all go through config['api_auth_db'].collection('AccountInfo').save({ :_id => 'i_am_awesome', 'valid' => true, 'max_call_rate' => 1_000_000 }) # this user's account is disabled config['api_auth_db'].collection('AccountInfo').save({ :_id => 'i_am_lame', 'valid' => false, 'max_call_rate' => 1_000 }) # this user has not been seen, but will very quickly hit their limit config['api_auth_db'].collection('AccountInfo').save({ :_id => 'i_am_limited', 'valid' => true, 'max_call_rate' => 10 }) # fakes a user with a bunch of calls already made this hour -- two more = no yuo config['api_auth_db'].collection('AccountInfo').save({ :_id => 'i_am_busy', 'valid' => true, 'max_call_rate' => 1_000 }) config['api_auth_db'].collection('UsageInfo').save({ :_id => "i_am_busy-#{timebin}", 'calls' => 999 }) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goliath-0.9.2 | examples/config/auth_and_rate_limit.rb |