From ff2ffa5c811a43e46c8bfedbbea462b954f6f979 Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Tue, 3 Dec 2024 17:31:00 -0800 Subject: [PATCH] Sync config/environments/staging.rb with production.rb --- config/environments/production.rb | 2 +- config/environments/staging.rb | 36 ++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index cc1793880ae..59845549237 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,4 +1,5 @@ require "active_support/core_ext/integer/time" +require_relative "../../lib/gemcutter/middleware/redirector" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -115,6 +116,5 @@ value_max_bytes: 2_097_152 # 2MB } - require_relative "../../lib/gemcutter/middleware/redirector" config.middleware.use Gemcutter::Middleware::Redirector end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index ae4726d99a0..c7486aa792b 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,4 +1,5 @@ require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file? +require "active_support/core_ext/integer/time" require_relative "../../lib/gemcutter/middleware/redirector" Rails.application.configure do @@ -7,14 +8,13 @@ # Code is not reloaded between requests. config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + # Full error reports are disabled. + config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. config.action_controller.perform_caching = true # Attempt to read encrypted secrets from `config/secrets.yml.enc`. @@ -58,21 +58,32 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. - config.log_level = ENV['RAILS_LOG_LEVEL'].present? ? ENV['RAILS_LOG_LEVEL'].to_sym : :info + $stdout.sync = true config.rails_semantic_logger.format = :json config.rails_semantic_logger.semantic = true config.rails_semantic_logger.add_file_appender = false - SemanticLogger.add_appender(io: $stdout, formatter: :json) + config.semantic_logger.add_appender(io: $stdout, formatter: config.rails_semantic_logger.format) # Prepend all log lines with the following tags. # config.log_tags = [ :request_id ] + # "info" includes generic and useful information about system operation, but avoids logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). If you + # want to log everything, set the level to "debug". + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + + # Don't log any deprecations. + config.active_support.report_deprecations = false + # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "gemcutter_#{Rails.env}" + + # Disable caching for Action Mailer templates even if Action Controller + # caching is enabled. config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -83,16 +94,17 @@ # roadie-rails recommends not setting action_mailer.asset_host and use its own configuration for URL options config.roadie.url_options = { host: Gemcutter::HOST, scheme: Gemcutter::PROTOCOL } + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = [:en] - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify + config.i18n.fallbacks = true # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [:id] + config.cache_store = :mem_cache_store, ENV['MEMCACHED_ENDPOINT'], { failover: true, socket_timeout: 1.5,