Bump loofah from 2.2.3 to 2.3.1 in /apps/workbench
[arvados.git] / services / api / config / application.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require File.expand_path('../boot', __FILE__)
6
7 require "rails"
8 # Pick only the frameworks we need:
9 require "active_model/railtie"
10 require "active_job/railtie"
11 require "active_record/railtie"
12 require "action_controller/railtie"
13 require "action_mailer/railtie"
14 require "action_view/railtie"
15 # Skip ActionCable (new in Rails 5.0) as it adds '/cable' routes that we're not using
16 # require "action_cable/engine"
17 require "sprockets/railtie"
18 require "rails/test_unit/railtie"
19
20 require 'digest'
21
22 module Kernel
23   def suppress_warnings
24     verbose_orig = $VERBOSE
25     begin
26       $VERBOSE = nil
27       yield
28     ensure
29       $VERBOSE = verbose_orig
30     end
31   end
32 end
33
34 if defined?(Bundler)
35   suppress_warnings do
36     # If you precompile assets before deploying to production, use this line
37     Bundler.require(*Rails.groups(:assets => %w(development test)))
38     # If you want your assets lazily compiled in production, use this line
39     # Bundler.require(:default, :assets, Rails.env)
40   end
41 end
42
43 module Server
44   class Application < Rails::Application
45     # The following is to avoid SafeYAML's warning message
46     SafeYAML::OPTIONS[:default_mode] = :safe
47
48     require_relative "arvados_config.rb"
49
50     # Settings in config/environments/* take precedence over those specified here.
51     # Application configuration should go into files in config/initializers
52     # -- all .rb files in that directory are automatically loaded.
53
54     # Custom directories with classes and modules you want to be autoloadable.
55     # config.autoload_paths += %W(#{config.root}/extras)
56
57     # Only load the plugins named here, in the order given (default is alphabetical).
58     # :all can be used as a placeholder for all plugins not explicitly named.
59     # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
60
61     # Activate observers that should always be running.
62     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
63     config.active_record.schema_format = :sql
64
65     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
66     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
67     # config.i18n.default_locale = :de
68
69     # Configure sensitive parameters which will be filtered from the log file.
70     config.filter_parameters += [:password]
71
72     # Load entire application at startup.
73     config.eager_load = true
74
75     config.active_support.test_order = :sorted
76
77     config.action_dispatch.perform_deep_munge = false
78
79     I18n.enforce_available_locales = false
80
81     # Before using the filesystem backend for Rails.cache, check
82     # whether we own the relevant directory. If we don't, using it is
83     # likely to either fail or (if we're root) pollute it and cause
84     # other processes to fail later.
85     default_cache_path = Rails.root.join('tmp', 'cache')
86     if not File.owned?(default_cache_path)
87       if File.exist?(default_cache_path)
88         why = "owner (uid=#{File::Stat.new(default_cache_path).uid}) " +
89           "is not me (uid=#{Process.euid})"
90       else
91         why = "does not exist"
92       end
93       STDERR.puts("Defaulting to memory cache, " +
94                   "because #{default_cache_path} #{why}")
95       config.cache_store = :memory_store
96     else
97       require Rails.root.join('lib/safer_file_store')
98       config.cache_store = ::SaferFileStore.new(default_cache_path)
99     end
100   end
101 end