1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require File.expand_path('../boot', __FILE__)
12 verbose_orig = $VERBOSE
17 $VERBOSE = verbose_orig
24 # If you precompile assets before deploying to production, use this line
25 Bundler.require(*Rails.groups(:assets => %w(development test)))
26 # If you want your assets lazily compiled in production, use this line
27 # Bundler.require(:default, :assets, Rails.env)
32 class Application < Rails::Application
33 # The following is to avoid SafeYAML's warning message
34 SafeYAML::OPTIONS[:default_mode] = :safe
36 # Settings in config/environments/* take precedence over those specified here.
37 # Application configuration should go into files in config/initializers
38 # -- all .rb files in that directory are automatically loaded.
40 # Custom directories with classes and modules you want to be autoloadable.
41 # config.autoload_paths += %W(#{config.root}/extras)
43 # Only load the plugins named here, in the order given (default is alphabetical).
44 # :all can be used as a placeholder for all plugins not explicitly named.
45 # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
47 # Activate observers that should always be running.
48 # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
49 config.active_record.schema_format = :sql
51 # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
52 # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
53 # config.i18n.default_locale = :de
55 # Configure sensitive parameters which will be filtered from the log file.
56 config.filter_parameters += [:password]
58 # Load entire application at startup.
59 config.eager_load = true
61 config.active_record.raise_in_transactional_callbacks = true
63 config.active_support.test_order = :sorted
65 config.action_dispatch.perform_deep_munge = false
67 I18n.enforce_available_locales = false
69 # Before using the filesystem backend for Rails.cache, check
70 # whether we own the relevant directory. If we don't, using it is
71 # likely to either fail or (if we're root) pollute it and cause
72 # other processes to fail later.
73 default_cache_path = Rails.root.join('tmp', 'cache')
74 if not File.owned?(default_cache_path)
75 if File.exist?(default_cache_path)
76 why = "owner (uid=#{File::Stat.new(default_cache_path).uid}) " +
77 "is not me (uid=#{Process.euid})"
79 why = "does not exist"
81 STDERR.puts("Defaulting to memory cache, " +
82 "because #{default_cache_path} #{why}")
83 config.cache_store = :memory_store
85 require Rails.root.join('lib/safer_file_store')
86 config.cache_store = ::SaferFileStore.new(default_cache_path)