upr.git  about / heads / tags
Upload Progress for Rack
blob c323778cfef032a62b62424fd576ad229bb5bb7a 2190 bytes (raw)
$ git show HEAD:examples/rails_app-2.3.4/config/environment.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
  # Skip frameworks you're not going to use. To use Rails without a database,
  # you must remove the Active Record framework.
  config.frameworks -= [ :active_resource, :action_mailer ]
  config.threadsafe!
  config.action_controller.session = { :key => "_upr", :secret => "a"*30 }
  config.gem "moneta"

  # for the purposes of running this example in the upr source tree, we'll
  # just add our working copy of upr to the load_paths, however using the
  # gem is recommended for production for ease-of-management
  if (example = true)
    config.load_paths += %W( #{RAILS_ROOT}/../../lib )
  else
    config.gem "upr"
  end

  # We MUST insert Upr before any parsers that read the body
  # since we need to wrap all calls to "rack.input"
  config.middleware.insert_before('ActionController::ParamsParser',
       'Upr',
       # The default is to use the Moneta::Memory store here.
       # This won't work right if you have multiple processes
       # serving your application, however.
       # :backend => ($upr = Upr::Monitor.new),
       #
       # this enables the use of the ActiveRecord store, see
       # app/models/upr_status.rb.  We pass this as a String
       # because ActiveRecord has not yet been loaded here.
       # :backend => "$upr = UprStatus",

       # You can specify an alternative Moneta-backed store here:
       # :backend => ($upr=Upr::Monitor.new(Moneta::Memory.new)),
       #
       # For mongrel_upload_progress compatibility, we can specify
       # a :drb option instead and leave :backend unset.
       #
       # Avoid DRb or any network-backed Moneta stores when using
       # Revactor unless they're using Revactor-aware network functions
       # :drb => 'druby://127.0.0.1:2999',
       #
       # Update at most once every second (default is every 3 seconds)
       :frequency => 1)
end

git clone https://yhbt.net/upr.git