|
| 1 | +# rubocop:disable Metrics/BlockLength |
| 2 | + |
| 3 | +Rails.application.configure do |
| 4 | + # Verifies that versions and hashed value of the package contents in the project's package.json |
| 5 | + config.webpacker.check_yarn_integrity = false |
| 6 | + |
| 7 | + # Settings specified here will take precedence over those in config/application.rb. |
| 8 | + |
| 9 | + # Code is not reloaded between requests. |
| 10 | + config.cache_classes = true |
| 11 | + |
| 12 | + # Eager load code on boot. This eager loads most of Rails and |
| 13 | + # your application in memory, allowing both threaded web servers |
| 14 | + # and those relying on copy on write to perform better. |
| 15 | + # Rake tasks automatically ignore this option for performance. |
| 16 | + config.eager_load = true |
| 17 | + |
| 18 | + # Full error reports are disabled and caching is turned on. |
| 19 | + config.consider_all_requests_local = false |
| 20 | + config.action_controller.perform_caching = true |
| 21 | + |
| 22 | + # Enable Rack::Cache to put a simple HTTP cache in front of your application |
| 23 | + # Add `rack-cache` to your Gemfile before enabling this. |
| 24 | + # For large-scale production use, consider using a caching reverse proxy like |
| 25 | + # NGINX, varnish or squid. |
| 26 | + # config.action_dispatch.rack_cache = true |
| 27 | + config.read_encrypted_secrets = true |
| 28 | + |
| 29 | + # Disable serving static files from the `/public` folder by default since |
| 30 | + # Apache or NGINX already handles this. |
| 31 | + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? |
| 32 | + config.public_file_server.headers = { |
| 33 | + "Cache-Control" => "public, s-maxage=2592000, max-age=86400" |
| 34 | + } |
| 35 | + |
| 36 | + # Compress JavaScripts and CSS. |
| 37 | + config.assets.js_compressor = Uglifier.new(harmony: true) |
| 38 | + # config.assets.css_compressor = :sass |
| 39 | + |
| 40 | + # Do not fallback to assets pipeline if a precompiled asset is missed. |
| 41 | + config.assets.compile = true |
| 42 | + |
| 43 | + # Asset digests allow you to set far-future HTTP expiration dates on all assets, |
| 44 | + # yet still be able to expire them through the digest params. |
| 45 | + config.assets.digest = true |
| 46 | + |
| 47 | + # `config.assets.precompile` and `config.assets.version` |
| 48 | + # have moved to config/initializers/assets.rb |
| 49 | + |
| 50 | + # Specifies the header that your server uses for sending files. |
| 51 | + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache |
| 52 | + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX |
| 53 | + |
| 54 | + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. |
| 55 | + # config.force_ssl = true |
| 56 | + |
| 57 | + # Use the lowest log level to ensure availability of diagnostic information |
| 58 | + # when problems arise. |
| 59 | + config.log_level = :debug |
| 60 | + |
| 61 | + # Prepend all log lines with the following tags. |
| 62 | + config.log_tags = [:request_id] |
| 63 | + |
| 64 | + # Use a different logger for distributed setups. |
| 65 | + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) |
| 66 | + |
| 67 | + # Use a different cache store in production. |
| 68 | + # config.cache_store = :mem_cache_store |
| 69 | + |
| 70 | + # Enable serving of images, stylesheets, and JavaScripts from an asset server. |
| 71 | + config.action_controller.asset_host = ENV["FASTLY_CDN_URL"] |
| 72 | + config.action_mailer.perform_caching = false |
| 73 | + |
| 74 | + # Ignore bad email addresses and do not raise email delivery errors. |
| 75 | + # Set this to true and configure the email server for immediate delivery to raise delivery errors. |
| 76 | + # config.action_mailer.raise_delivery_errors = false |
| 77 | + |
| 78 | + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to |
| 79 | + # the I18n.default_locale when a translation cannot be found). |
| 80 | + config.i18n.fallbacks = [I18n.default_locale] |
| 81 | + |
| 82 | + # Send deprecation notices to registered listeners. |
| 83 | + config.active_support.deprecation = :notify |
| 84 | + |
| 85 | + # Use default logging formatter so that PID and timestamp are not suppressed. |
| 86 | + # config.log_formatter = ::Logger::Formatter.new |
| 87 | + config.log_formatter = ::Logger::Formatter.new |
| 88 | + if ENV["RAILS_LOG_TO_STDOUT"].present? |
| 89 | + logger = ActiveSupport::Logger.new(STDOUT) |
| 90 | + logger.formatter = config.log_formatter |
| 91 | + config.logger = ActiveSupport::TaggedLogging.new(logger) |
| 92 | + end |
| 93 | + |
| 94 | + # Install the Timber.io logger |
| 95 | + send_logs_to_timber = ENV["SEND_LOGS_TO_TIMBER"] || "false" # <---- set to false to stop sending dev logs to Timber.io |
| 96 | + log_device = send_logs_to_timber == "true" ? Timber::LogDevices::HTTP.new(ENV["TIMBER"]) : STDOUT |
| 97 | + logger = Timber::Logger.new(log_device) |
| 98 | + logger.level = config.log_level |
| 99 | + config.logger = ActiveSupport::TaggedLogging.new(logger) |
| 100 | + |
| 101 | + # Do not dump schema after migrations. |
| 102 | + config.active_record.dump_schema_after_migration = false |
| 103 | + |
| 104 | + config.cache_store = :dalli_store, |
| 105 | + (ENV["MEMCACHIER_SERVERS"] || "").split(","), |
| 106 | + { username: ENV["MEMCACHIER_USERNAME"], |
| 107 | + password: ENV["MEMCACHIER_PASSWORD"], |
| 108 | + failover: true, |
| 109 | + socket_timeout: 1.5, |
| 110 | + socket_failure_delay: 0.2 } |
| 111 | + |
| 112 | + config.app_domain = "dev.to" |
| 113 | + |
| 114 | + config.action_mailer.delivery_method = :smtp |
| 115 | + config.action_mailer.perform_deliveries = true |
| 116 | + config.action_mailer.default_url_options = { host: config.app_domain } |
| 117 | + ActionMailer::Base.smtp_settings = { |
| 118 | + address: "smtp.sendgrid.net", |
| 119 | + port: "587", |
| 120 | + authentication: :plain, |
| 121 | + user_name: ENV["SENDGRID_USERNAME_ACCEL"], |
| 122 | + password: ENV["SENDGRID_PASSWORD_ACCEL"], |
| 123 | + domain: "dev.to", |
| 124 | + enable_starttls_auto: true |
| 125 | + } |
| 126 | + |
| 127 | + config.middleware.use Rack::HostRedirect, |
| 128 | + "practicaldev.herokuapp.com" => "dev.to" |
| 129 | +end |
| 130 | + |
| 131 | +# rubocop:enable Metrics/BlockLength |
0 commit comments