1 # Be sure to restart your web server when you modify this file.
3 # Limit each rails process to a 512Mb resident set size
4 Process.setrlimit Process::RLIMIT_AS, 640*1024*1024, Process::RLIM_INFINITY
6 # Uncomment below to force Rails into production mode when
7 # you don't control web/app server and can't set it the proper way
8 ENV['RAILS_ENV'] ||= 'production'
10 # Specifies gem version of Rails to use when vendor/rails is not present
11 RAILS_GEM_VERSION = '1.2.3'
13 # Bootstrap the Rails environment, frameworks, and default configuration
14 require File.join(File.dirname(__FILE__), 'boot')
16 # Application constants needed for routes.rb - must go before Initializer call
17 API_VERSION = ENV['OSM_API_VERSION'] || '0.5'
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+/, "")]
26 Rails::Initializer.run do |config|
27 # Settings in config/environments/* take precedence those specified here
29 # Skip frameworks you're not going to use
30 # config.frameworks -= [ :action_web_service, :action_mailer ]
32 # Add additional load paths for your own custom dirs
33 # config.load_paths += %W( #{RAILS_ROOT}/extras )
35 # Force all environments to use the same logger level
36 # (by default production uses :info, the others :debug)
37 # config.log_level = :debug
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)
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
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
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
59 # Activate observers that should always be running
60 # config.active_record.observers = :cacher, :garbage_collector
62 # Make Active Record use UTC-base instead of local time
63 # config.active_record.default_timezone = :utc
65 # See Rails::Configuration for more options
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 )
77 # Hack the AssetTagHelper to make asset tagging work better
82 alias :old_compute_public_path :compute_public_path
84 def compute_public_path(source, dir, ext)
85 path = old_compute_public_path(source, dir, ext)
86 if path =~ /(.+)\?(\d+)\??$/
95 # Set to :readonly to put the API in read-only mode or :offline to
96 # take it completely offline
99 # Include your application configuration below
100 SERVER_URL = ENV['OSM_SERVER_URL'] || 'www.openstreetmap.org'
102 ActionMailer::Base.smtp_settings = {
103 :address => "localhost",
105 :domain => 'localhost',