Commit 997752f2 authored by John E. Vincent's avatar John E. Vincent

make max ephemeral size configurable

parent e11b5219
......@@ -6,4 +6,5 @@ require 'vegas'
Vegas::Runner.new(Noah::App, 'noah') do |runner, opts, app|
opts.on("-r", "--redis URL", "redis url to connect to (default: redis://localhost:6379/0)") {|r| ENV["REDIS_URL"] = r; Noah::App.set :redis_url, r }
opts.on("--esize SIZE", Integer, "Max allowed ephemeral size in bytes") {|esize| Noah::App.set :ephemeral_size, esize }
end
......@@ -16,6 +16,7 @@ module Noah
set :show_exceptions, false
set :run, false
set :redis_url, ENV['REDIS_URL'] || 'redis://localhost:6379/0'
set :ephemeral_size, ENV['NOAH_ESIZE'] || 512
end
configure(:development) do
......@@ -48,7 +49,12 @@ module Noah
haml :index, :format => :html5, :locals => {:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}
end
get '/', :provides => :json do
content_type "application/json"
erb :'index.json', :locals => {:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}
end
get '/version' do
content_type "application/json"
{:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}.to_json
......
......@@ -19,7 +19,7 @@ class Noah::App
end
put '/ephemerals/*' do
raise("Data too large") if request.body.size > 512
raise("Data too large") if request.body.size > settings.ephemeral_size
d = request.body.read || nil
opts = {:path => "/#{params[:splat][0]}", :data => d}
e = Noah::Ephemeral.find_or_create(opts)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment