Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 100 lines (85 sloc) 3.337 kB
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
1 require 'rails/engine/configuration'
2
3 module Rails
4 class Application
5 class Configuration < ::Rails::Engine::Configuration
6 include ::Rails::Configuration::Deprecated
7
c2dbc39 Have log subscribers subscribe to the actual events, so the subscribe…
Carlhuda authored
8 attr_accessor :allow_concurrency, :cache_classes, :cache_store,
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
9 :consider_all_requests_local, :dependency_loading,
10 :filter_parameters, :log_level, :logger, :metals,
64ea3df @josevalim Add reloadable specific for engines and move environment to applicati…
josevalim authored
11 :plugins, :preload_frameworks, :reload_engines, :reload_plugins,
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
12 :serve_static_assets, :time_zone, :whiny_nils
13
14 def initialize(*)
15 super
0dece79 @josevalim Deprecate AC configuration values which were moved to Rack.
josevalim authored
16 @allow_concurrency = false
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
17 @filter_parameters = []
18 @dependency_loading = true
19 @serve_static_assets = true
64ea3df @josevalim Add reloadable specific for engines and move environment to applicati…
josevalim authored
20 @time_zone = "UTC"
0dece79 @josevalim Deprecate AC configuration values which were moved to Rack.
josevalim authored
21 @consider_all_requests_local = true
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
22 end
23
ae93789 Move middlewares to the Application level. If you want to modify the …
Carlhuda authored
24 def middleware
25 @@default_middleware_stack ||= default_middleware
26 end
27
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
28 def paths
29 @paths ||= begin
30 paths = super
31 paths.app.controllers << builtin_controller if builtin_controller
32 paths.config.database "config/database.yml"
64ea3df @josevalim Add reloadable specific for engines and move environment to applicati…
josevalim authored
33 paths.config.environment "config/environments", :glob => "#{Rails.env}.rb"
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
34 paths.log "log/#{Rails.env}.log"
35 paths.tmp "tmp"
36 paths.tmp.cache "tmp/cache"
37 paths.vendor "vendor", :load_path => true
38 paths.vendor.plugins "vendor/plugins"
39
40 if File.exists?("#{root}/test/mocks/#{Rails.env}")
41 ActiveSupport::Deprecation.warn "\"RAILS_ROOT/test/mocks/#{Rails.env}\" won't be added " <<
42 "automatically to load paths anymore in future releases"
43 paths.mocks_path "test/mocks", :load_path => true, :glob => Rails.env
44 end
45
46 paths
47 end
48 end
49
50 # Enable threaded mode. Allows concurrent requests to controller actions and
51 # multiple database connections. Also disables automatic dependency loading
52 # after boot, and disables reloading code on every request, as these are
53 # fundamentally incompatible with thread safety.
54 def threadsafe!
55 self.preload_frameworks = true
56 self.cache_classes = true
57 self.dependency_loading = false
0dece79 @josevalim Deprecate AC configuration values which were moved to Rack.
josevalim authored
58 self.allow_concurrency = true
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
59 self
60 end
61
62 # Loads and returns the contents of the #database_configuration_file. The
63 # contents of the file are processed via ERB before being sent through
64 # YAML::load.
65 def database_configuration
66 require 'erb'
67 YAML::load(ERB.new(IO.read(paths.config.database.to_a.first)).result)
68 end
69
70 def cache_store
71 @cache_store ||= begin
72 if File.exist?("#{root}/tmp/cache/")
73 [ :file_store, "#{root}/tmp/cache/" ]
74 else
75 :memory_store
76 end
77 end
78 end
79
80 def builtin_controller
f38e89c @josh Move railties/builtin into lib
josh authored
81 File.expand_path('../info_routes', __FILE__) if Rails.env.development?
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
82 end
83
84 def log_level
85 @log_level ||= Rails.env.production? ? :info : :debug
86 end
c2dbc39 Have log subscribers subscribe to the actual events, so the subscribe…
Carlhuda authored
87
88 def colorize_logging
89 @colorize_logging
90 end
91
92 def colorize_logging=(val)
93 @colorize_logging = val
94 Rails::LogSubscriber.colorize_logging = val
95 self.generators.colorize_logging = val
96 end
b17e358 @josevalim Move configuration to subfolders.
josevalim authored
97 end
98 end
f38e89c @josh Move railties/builtin into lib
josh authored
99 end
Something went wrong with that request. Please try again.