Skip to content

Commit 5cdfe7f

Browse files
author
Nyaz Jaff
committed
update prod config
1 parent 6885cad commit 5cdfe7f

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

config/environments/production.rb

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Settings specified here will take precedence over those in config/application.rb.
55

66
# Code is not reloaded between requests.
7-
config.enable_reloading = false
7+
config.cache_classes = true
88

99
# Eager load code on boot. This eager loads most of Rails and
1010
# your application in memory, allowing both threaded web servers
@@ -13,20 +13,21 @@
1313
config.eager_load = true
1414

1515
# Full error reports are disabled and caching is turned on.
16-
config.consider_all_requests_local = false
16+
config.consider_all_requests_local = false
1717
config.action_controller.perform_caching = true
1818

19-
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20-
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
19+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
2121
# config.require_master_key = true
2222

23-
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
24-
# config.public_file_server.enabled = false
23+
# Disable serving static files from the `/public` folder by default since
24+
# Apache or NGINX already handles this.
25+
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
2526

2627
# Compress CSS using a preprocessor.
2728
# config.assets.css_compressor = :sass
2829

29-
# Do not fall back to assets pipeline if a precompiled asset is missed.
30+
# Do not fallback to assets pipeline if a precompiled asset is missed.
3031
config.assets.compile = false
3132

3233
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
@@ -44,32 +45,22 @@
4445
# config.action_cable.url = "wss://example.com/cable"
4546
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
4647

47-
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
48-
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
49-
# config.assume_ssl = true
50-
5148
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52-
config.force_ssl = true
49+
# config.force_ssl = true
5350

54-
# Log to STDOUT by default
55-
config.logger = ActiveSupport::Logger.new(STDOUT)
56-
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
57-
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
51+
# Include generic and useful information about system operation, but avoid logging too much
52+
# information to avoid inadvertent exposure of personally identifiable information (PII).
53+
config.log_level = :info
5854

5955
# Prepend all log lines with the following tags.
6056
config.log_tags = [ :request_id ]
6157

62-
# "info" includes generic and useful information about system operation, but avoids logging too much
63-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
64-
# want to log everything, set the level to "debug".
65-
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
66-
6758
# Use a different cache store in production.
6859
# config.cache_store = :mem_cache_store
6960

7061
# Use a real queuing backend for Active Job (and separate queues per environment).
71-
# config.active_job.queue_adapter = :resque
72-
# config.active_job.queue_name_prefix = "testproject_production"
62+
# config.active_job.queue_adapter = :resque
63+
# config.active_job.queue_name_prefix = "sample_rails_2_production"
7364

7465
config.action_mailer.perform_caching = false
7566

@@ -84,14 +75,19 @@
8475
# Don't log any deprecations.
8576
config.active_support.report_deprecations = false
8677

78+
# Use default logging formatter so that PID and timestamp are not suppressed.
79+
config.log_formatter = ::Logger::Formatter.new
80+
81+
# Use a different logger for distributed setups.
82+
# require "syslog/logger"
83+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
84+
85+
if ENV["RAILS_LOG_TO_STDOUT"].present?
86+
logger = ActiveSupport::Logger.new(STDOUT)
87+
logger.formatter = config.log_formatter
88+
config.logger = ActiveSupport::TaggedLogging.new(logger)
89+
end
90+
8791
# Do not dump schema after migrations.
8892
config.active_record.dump_schema_after_migration = false
89-
90-
# Enable DNS rebinding protection and other `Host` header attacks.
91-
# config.hosts = [
92-
# "example.com", # Allow requests from example.com
93-
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
94-
# ]
95-
# Skip DNS rebinding protection for the default health check endpoint.
96-
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
9793
end

0 commit comments

Comments
 (0)