# frozen_string_literal: true #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See COPYRIGHT and LICENSE files for more details. #++ require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.enable_reloading = true # Do not eager load code on boot by default. config.eager_load = ENV["EAGER_LOAD"].present? # Asynchronous file watcher config.file_watcher = ActiveSupport::EventedFileUpdateChecker # Show full error reports config.consider_all_requests_local = true # Enable server timing config.server_timing = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't perform caching for Action Mailer in development config.action_mailer.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise exceptions for disallowed deprecations. config.active_support.disallowed_deprecation = :raise # Tell Active Support which deprecation messages to disallow. config.active_support.disallowed_deprecation_warnings = [] # Raise an error on page load if there are pending migrations. config.active_record.migration_error = ENV["OPENPROJECT_DISABLE__MIGRATIONS__CHECK"] == "true" ? false : :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true # Disable compression and asset digests, but disable debug config.assets.debug = false config.assets.digest = false # Suppress logger output for asset requests. config.assets.quiet = true unless config.log_level == :debug # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names config.action_view.annotate_rendered_view_with_filenames = true # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true # Raise error when a before_action's only/except options reference missing actions config.action_controller.raise_on_missing_callback_actions = true # Send mails to browser window (unless configured otherwise) config.action_mailer.delivery_method = ENV["OPENPROJECT_EMAIL_DELIVERY_METHOD"]&.to_sym || :letter_opener_web # Set email preview locations to rspec config.action_mailer.preview_paths << Rails.root.join("spec/mailers/previews") # Used with `bin/safari_browser_stack` for testing Safari on Browser Stack # Allow Browser Stack local server when assets are proxied config.hosts << "bs-local.com" if ENV["OPENPROJECT_DISABLE_DEV_ASSET_PROXY"].present? if ENV["OPENPROJECT_DEV_EXTRA_HOSTS"].present? config.hosts.push(*ENV["OPENPROJECT_DEV_EXTRA_HOSTS"].split(",")) end # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. config.generators.apply_rubocop_autocorrect_after_generate! end ActiveRecord::Base.logger = ActiveSupport::Logger.new($stdout) unless String(ENV.fetch("SILENCE_SQL_LOGS", nil)).to_bool