]> git.openstreetmap.org Git - rails.git/blob - config/environment.rb
Add a model for sessions.
[rails.git] / config / environment.rb
1 # Be sure to restart your web server when you modify this file.
2
3 # Uncomment below to force Rails into production mode when 
4 # you don't control web/app server and can't set it the proper way
5 ENV['RAILS_ENV'] ||= 'production'
6
7 # Don't add asset tags
8 ENV["RAILS_ASSET_ID"] = ''
9
10 # Specifies gem version of Rails to use when vendor/rails is not present
11 RAILS_GEM_VERSION = '1.2.3'
12
13 # Bootstrap the Rails environment, frameworks, and default configuration
14 require File.join(File.dirname(__FILE__), 'boot')
15
16 # Application constants needed for routes.rb - must go before Initializer call
17 API_VERSION = ENV['OSM_API_VERSION'] || '0.4'
18
19 # Custom logger class to format messages sensibly
20 class OSMLogger < Logger
21   def format_message(severity, time, progname, msg)
22     "[%s.%06d #%d] %s\n" % [time.strftime("%Y-%m-%d %H:%M:%S"), time.usec, $$, msg.sub(/^\n+/, "")]
23   end
24 end
25
26 Rails::Initializer.run do |config|
27   # Settings in config/environments/* take precedence those specified here
28   
29   # Skip frameworks you're not going to use
30   # config.frameworks -= [ :action_web_service, :action_mailer ]
31
32   # Add additional load paths for your own custom dirs
33   # config.load_paths += %W( #{RAILS_ROOT}/extras )
34
35   # Force all environments to use the same logger level 
36   # (by default production uses :info, the others :debug)
37   # config.log_level = :debug
38
39   # Use our custom logger
40   config.logger = OSMLogger.new(config.log_path)
41   config.logger.level = Logger.const_get(config.log_level.to_s.upcase)
42
43   # Use the database for sessions instead of the file system
44   # (create the session table with 'rake db:sessions:create')
45   # config.action_controller.session_store = :sql_session_store
46
47   # Unfortunately SqlSessionStore is a plugin which has not been
48   # loaded yet, so we have to do things the hard way...
49   config.after_initialize do
50     ActionController::Base.session_store = :sql_session_store
51     SqlSessionStore.session_class = MysqlSession
52   end
53
54   # Use SQL instead of Active Record's schema dumper when creating the test database.
55   # This is necessary if your schema can't be completely dumped by the schema dumper, 
56   # like if you have constraints or database-specific column types
57   config.active_record.schema_format = :sql
58
59   # Activate observers that should always be running
60   # config.active_record.observers = :cacher, :garbage_collector
61
62   # Make Active Record use UTC-base instead of local time
63   # config.active_record.default_timezone = :utc
64   
65   # See Rails::Configuration for more options
66 end
67
68 # Add new inflection rules using the following format 
69 # (all these examples are active by default):
70 # Inflector.inflections do |inflect|
71 #   inflect.plural /^(ox)$/i, '\1en'
72 #   inflect.singular /^(ox)en/i, '\1'
73 #   inflect.irregular 'person', 'people'
74 #   inflect.uncountable %w( fish sheep )
75 # end
76
77 # Set to true to put the API in read-only mode
78 API_READONLY = false
79
80 # Include your application configuration below
81 SERVER_URL = ENV['OSM_SERVER_URL'] || 'www.openstreetmap.org'
82
83 ActionMailer::Base.smtp_settings = {
84   :address  => "localhost",
85   :port  => 25, 
86   :domain  => 'localhost',
87
88
89 #Taming FCGI
90 #
91 COUNT = 0
92 MAX_COUNT = 10000
93
94
95
96