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' ...@@ -6,4 +6,5 @@ require 'vegas'
Vegas::Runner.new(Noah::App, 'noah') do |runner, opts, app| 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("-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 end
...@@ -16,6 +16,7 @@ module Noah ...@@ -16,6 +16,7 @@ module Noah
set :show_exceptions, false set :show_exceptions, false
set :run, false set :run, false
set :redis_url, ENV['REDIS_URL'] || 'redis://localhost:6379/0' set :redis_url, ENV['REDIS_URL'] || 'redis://localhost:6379/0'
set :ephemeral_size, ENV['NOAH_ESIZE'] || 512
end end
configure(:development) do configure(:development) do
...@@ -49,6 +50,11 @@ module Noah ...@@ -49,6 +50,11 @@ module Noah
haml :index, :format => :html5, :locals => {:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION} haml :index, :format => :html5, :locals => {:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}
end 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 get '/version' do
content_type "application/json" content_type "application/json"
{:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}.to_json {:redis_version => Ohm.redis.info["redis_version"].to_s, :noah_version => Noah::VERSION}.to_json
......
...@@ -19,7 +19,7 @@ class Noah::App ...@@ -19,7 +19,7 @@ class Noah::App
end end
put '/ephemerals/*' do 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 d = request.body.read || nil
opts = {:path => "/#{params[:splat][0]}", :data => d} opts = {:path => "/#{params[:splat][0]}", :data => d}
e = Noah::Ephemeral.find_or_create(opts) 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