require 'yaml' require 'rbconfig' # Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '1.2.4' # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') # The following section has been added to load database settings from system config. APP_CONFIG_FILE = Config::CONFIG["sysconfdir"] + '/backlog.conf' if File.exists? APP_CONFIG_FILE puts "Found global config file (#{APP_CONFIG_FILE})" module Rails class Configuration def database_configuration db_conf = YAML::load(ERB.new(IO.read(database_configuration_file)).result) app_conf = YAML::load(ERB.new(IO.read(APP_CONFIG_FILE)).result) || {} if db_settings = app_conf['database'] puts "Found global database connection settings: #{db_settings.inspect}" db_conf['production'] = db_settings end db_conf end end end else puts "Optional global config file not present (#{APP_CONFIG_FILE})" end DB_CONFIG_FILE = Config::CONFIG["sysconfdir"] + '/backlog/config/database.yml' if File.exists? DB_CONFIG_FILE puts "Found global database config file (#{DB_CONFIG_FILE})" module Rails class Configuration def database_configuration_file DB_CONFIG_FILE end end end else puts "Optional global database config file not present (#{DB_CONFIG_FILE})" end if RUBY_PLATFORM =~ /java/ require 'rubygems' RAILS_CONNECTION_ADAPTERS = %w(jdbc) require 'postgresql-8.2-504.jdbc4' end Rails::Initializer.run do |config| # Settings in config/environments/* take precedence those specified here # Skip frameworks you're not going to use # config.frameworks -= [ :action_web_service, :action_mailer ] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Force all environments to use the same logger level # (by default production uses :info, the others :debug) # config.log_level = :debug # Use the database for sessions instead of the file system # (create the session table with 'rake db:sessions:create') # config.action_controller.session_store = :active_record_store #config.action_controller.session = { :session_key => "_backlog_session", :secret => "it is but a figment of my mind" } # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector # Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc # See Rails::Configuration for more options end # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # Include your application configuration below require 'environments/localization_environment' require 'localization' Localization::load_localized_strings require 'rubygems' require 'environments/user_environment' require 'array_helper' require 'big_decimal_yaml_fix' require 'class_table_inheritance' require 'version_from_history' require 'user_system' require 'url_for_fix' if RUBY_PLATFORM !~ /(i386-mswin32|java)/ gem 'slave' require 'slave' work_lock_nagger_thread = Slave.object(:async=>true) {WorkLockNagger.new.nag} else puts "Not spawning worklog nagger on #$1 platform." end