Class: Rockstart::Deployment::NginxGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rockstart::Deployment::NginxGenerator
- Defined in:
- lib/generators/rockstart/deployment/nginx/nginx_generator.rb
Constant Summary collapse
- SENDFILE_REGEX =
/#.+\.x_sendfile_header.+# for NGINX$/.freeze
Instance Method Summary collapse
Instance Method Details
#configure_sendfiles ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/rockstart/deployment/nginx/nginx_generator.rb', line 9 def configure_sendfiles inject_into_file "config/environments/production.rb", after: SENDFILE_REGEX do <<~'SENDFILE'.split("\n").map { |line| " #{line}".rstrip }.join("\n") unless ENV['RAILS_SERVE_STATIC_FILES'].present? config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX end SENDFILE end end |