development.rb 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # frozen_string_literal: true
  2. require 'active_support/core_ext/integer/time'
  3. Rails.application.configure do
  4. # Settings specified here will take precedence over those in config/application.rb.
  5. # In the development environment your application's code is reloaded any time
  6. # it changes. This slows down response time but is perfect for development
  7. # since you don't have to restart the web server when you make code changes.
  8. config.cache_classes = false
  9. # Do not eager load code on boot.
  10. config.eager_load = false
  11. # Show full error reports.
  12. config.consider_all_requests_local = true
  13. # Enable server timing
  14. config.server_timing = true
  15. # Enable/disable caching. By default caching is disabled.
  16. # Run rails dev:cache to toggle caching.
  17. if Rails.root.join('tmp', 'caching-dev.txt').exist?
  18. config.action_controller.perform_caching = true
  19. config.action_controller.enable_fragment_cache_logging = true
  20. config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS
  21. config.public_file_server.headers = {
  22. 'Cache-Control' => "public, max-age=#{2.days.to_i}",
  23. }
  24. else
  25. config.action_controller.perform_caching = false
  26. config.cache_store = :null_store
  27. end
  28. config.action_controller.forgery_protection_origin_check = ENV['DISABLE_FORGERY_REQUEST_PROTECTION'].nil?
  29. ActiveSupport::Logger.new(STDOUT).tap do |logger|
  30. logger.formatter = config.log_formatter
  31. config.logger = ActiveSupport::TaggedLogging.new(logger)
  32. end
  33. # Generate random VAPID keys
  34. Webpush.generate_key.tap do |vapid_key|
  35. config.x.vapid_private_key = vapid_key.private_key
  36. config.x.vapid_public_key = vapid_key.public_key
  37. end
  38. # Don't care if the mailer can't send.
  39. config.action_mailer.raise_delivery_errors = false
  40. config.action_mailer.perform_caching = false
  41. # Print deprecation notices to the Rails logger.
  42. config.active_support.deprecation = :log
  43. # Raise exceptions for disallowed deprecations.
  44. config.active_support.disallowed_deprecation = :raise
  45. # Tell Active Support which deprecation messages to disallow.
  46. config.active_support.disallowed_deprecation_warnings = []
  47. # Raise an error on page load if there are pending migrations.
  48. config.active_record.migration_error = :page_load
  49. # Highlight code that triggered database queries in logs.
  50. config.active_record.verbose_query_logs = true
  51. # Debug mode disables concatenation and preprocessing of assets.
  52. config.assets.debug = true
  53. # Suppress logger output for asset requests.
  54. config.assets.quiet = true
  55. # Adds additional error checking when serving assets at runtime.
  56. # Checks for improperly declared sprockets dependencies.
  57. # Raises helpful error messages.
  58. config.assets.raise_runtime_errors = true
  59. # Raises error for missing translations.
  60. # config.i18n.raise_on_missing_translations = true
  61. # Annotate rendered view with file names.
  62. # config.action_view.annotate_rendered_view_with_filenames = true
  63. # Uncomment if you wish to allow Action Cable access from any origin.
  64. # config.action_cable.disable_request_forgery_protection = true
  65. config.action_mailer.default_options = { from: 'notifications@localhost' }
  66. # If using a Heroku, Vagrant or generic remote development environment,
  67. # use letter_opener_web, accessible at /letter_opener.
  68. # Otherwise, use letter_opener, which launches a browser window to view sent mail.
  69. config.action_mailer.delivery_method = (ENV['HEROKU'] || ENV['VAGRANT'] || ENV['REMOTE_DEV']) ? :letter_opener_web : :letter_opener
  70. # We provide a default secret for the development environment here.
  71. # This value should not be used in production environments!
  72. config.x.otp_secret = ENV.fetch('OTP_SECRET', '1fc2b87989afa6351912abeebe31ffc5c476ead9bf8b3d74cbc4a302c7b69a45b40b1bbef3506ddad73e942e15ed5ca4b402bf9a66423626051104f4b5f05109')
  73. end
  74. Redis.raise_deprecations = true