aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-11-03 23:02:00 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-11-03 23:10:55 +0100
commit748b2f9cb1ff05a8aab068e2fa802e9f12163e30 (patch)
tree92c1171f8ae5ea2fc597e26a4692e41aeb031128 /railties/lib/rails/generators
parente37b470a6675a05df5a57455a3ac8c1c88ef04d6 (diff)
downloadrails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.tar.gz
rails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.tar.bz2
rails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.zip
Add enabled flag to the public file server.
As discussed in https://github.com/rails/rails/pull/19135#issuecomment-153385986. Replaces `serve_static_files` to unify the static options under the `public_file_server` wing. Deprecates `serve_static_files` accessors, but make them use the newer config internally.
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt4
2 files changed, 3 insertions, 3 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
index 0297ab75f6..a5302550fa 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
@@ -16,7 +16,7 @@ Rails.application.configure do
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
<%- unless options.skip_sprockets? -%>
# Compress JavaScripts and CSS.
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
index 5165100c22..8133917591 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
@@ -12,8 +12,8 @@ Rails.application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # Configure static file server for tests with Cache-Control for performance.
- config.serve_static_files = true
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}