10816: Merge branch 'master' into 10816-postgres-permissions
[arvados.git] / services / api / config / application.rb
1 require File.expand_path('../boot', __FILE__)
2
3 require 'rails/all'
4 require 'digest'
5
6 if defined?(Bundler)
7   # If you precompile assets before deploying to production, use this line
8   Bundler.require(*Rails.groups(:assets => %w(development test)))
9   # If you want your assets lazily compiled in production, use this line
10   # Bundler.require(:default, :assets, Rails.env)
11 end
12
13 module Server
14   class Application < Rails::Application
15     # Settings in config/environments/* take precedence over those specified here.
16     # Application configuration should go into files in config/initializers
17     # -- all .rb files in that directory are automatically loaded.
18
19     # Custom directories with classes and modules you want to be autoloadable.
20     # config.autoload_paths += %W(#{config.root}/extras)
21
22     # Only load the plugins named here, in the order given (default is alphabetical).
23     # :all can be used as a placeholder for all plugins not explicitly named.
24     # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
26     # Activate observers that should always be running.
27     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28     config.active_record.schema_format = :sql
29
30     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32     # config.i18n.default_locale = :de
33
34     # Configure sensitive parameters which will be filtered from the log file.
35     config.filter_parameters += [:password]
36
37     I18n.enforce_available_locales = false
38
39     # Before using the filesystem backend for Rails.cache, check
40     # whether we own the relevant directory. If we don't, using it is
41     # likely to either fail or (if we're root) pollute it and cause
42     # other processes to fail later.
43     default_cache_path = Rails.root.join('tmp', 'cache')
44     if not File.owned?(default_cache_path)
45       if File.exist?(default_cache_path)
46         why = "owner (uid=#{File::Stat.new(default_cache_path).uid}) " +
47           "is not me (uid=#{Process.euid})"
48       else
49         why = "does not exist"
50       end
51       STDERR.puts("Defaulting to memory cache, " +
52                   "because #{default_cache_path} #{why}")
53       config.cache_store = :memory_store
54     end
55   end
56 end