Project

General

Profile

Patch #35081 » 0002-Update-config-environments-.rb-for-Rails-6.1.patch

Go MAEDA, 2021-12-30 03:42

View differences:

Gemfile
84 84
end
85 85

  
86 86
group :development do
87
  gem 'listen', '~> 3.3'
87 88
  gem "yard"
88 89
end
89 90

  
config/environments/development.rb
1 1
# frozen_string_literal: true
2 2

  
3
require 'active_support/core_ext/integer/time'
4

  
3 5
Rails.application.configure do
4
  # Settings specified here will take precedence over those in config/application.rb
6
  # Settings specified here will take precedence over those in config/application.rb.
5 7

  
6
  # In the development environment your application's code is reloaded on
7
  # every request.  This slows down response time but is perfect for development
8
  # since you don't have to restart the webserver when you make code changes.
8
  # In the development environment your application's code is reloaded any time
9
  # it changes. This slows down response time but is perfect for development
10
  # since you don't have to restart the web server when you make code changes.
9 11
  config.cache_classes = false
10 12

  
11 13
  # Do not eager load code on boot.
12 14
  config.eager_load = false
13 15

  
14
  # Show full error reports and disable caching
16
  # Show full error reports.
15 17
  config.consider_all_requests_local = true
16
  config.action_controller.perform_caching = false
17 18

  
18
  # Disable delivery errors
19
  config.action_mailer.raise_delivery_errors = false
19
  # Enable/disable caching. By default caching is disabled.
20
  # Run rails dev:cache to toggle caching.
21
  if Rails.root.join('tmp', 'caching-dev.txt').exist?
22
    config.action_controller.perform_caching = true
23
    config.action_controller.enable_fragment_cache_logging = true
24

  
25
    config.cache_store = :memory_store
26
    config.public_file_server.headers = {
27
      'Cache-Control' => "public, max-age=#{2.days.to_i}"
28
    }
29
  else
30
    config.action_controller.perform_caching = false
31

  
32
    config.cache_store = :null_store
33
  end
20 34

  
21
  # Print deprecation notices to stderr and the Rails logger.
35
  # Print deprecation notices to the Rails logger.
22 36
  config.active_support.deprecation = [:stderr, :log]
37

  
38
  # Raise exceptions for disallowed deprecations.
39
  config.active_support.disallowed_deprecation = :raise
40

  
41
  # Tell Active Support which deprecation messages to disallow.
42
  config.active_support.disallowed_deprecation_warnings = []
43

  
44
  # Raise an error on page load if there are pending migrations.
45
  config.active_record.migration_error = :page_load
46

  
47
  # Highlight code that triggered database queries in logs.
48
  config.active_record.verbose_query_logs = true
49

  
50
  # Raises error for missing translations.
51
  # config.i18n.raise_on_missing_translations = true
52

  
53
  # Annotate rendered view with file names.
54
  # config.action_view.annotate_rendered_view_with_filenames = true
55

  
56
  # Use an evented file watcher to asynchronously detect changes in source code,
57
  # routes, locales, etc. This feature depends on the listen gem.
58
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
59

  
60
  # Uncomment if you wish to allow Action Cable access from any origin.
61
  # config.action_cable.disable_request_forgery_protection = true
23 62
end
config/environments/production.rb
1 1
# frozen_string_literal: true
2 2

  
3
require 'active_support/core_ext/integer/time'
4

  
3 5
Rails.application.configure do
4
  # Settings specified here will take precedence over those in config/application.rb
6
  # Settings specified here will take precedence over those in config/application.rb.
5 7

  
6 8
  # Code is not reloaded between requests.
7 9
  config.cache_classes = true
......
13 15
  config.eager_load = true
14 16

  
15 17
  # Full error reports are disabled and caching is turned on.
16
  config.consider_all_requests_local = false
18
  config.consider_all_requests_local       = false
17 19
  config.action_controller.perform_caching = true
18 20

  
21
  # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
  # config.require_master_key = true
24

  
25
  # Disable serving static files from the `/public` folder by default since
26
  # Apache or NGINX already handles this.
27
  # config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28

  
29
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
30
  # config.asset_host = 'http://assets.example.com'
31

  
32
  # Specifies the header that your server uses for sending files.
33
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
34
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
35

  
36
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
37
  # config.force_ssl = true
38

  
39
  # Prepend all log lines with the following tags.
40
  config.log_tags = [:request_id]
41

  
42
  # Use a different cache store in production.
43
  # config.cache_store = :mem_cache_store
44

  
45
  # Send deprecation notices to registered listeners.
46
  config.active_support.deprecation = :log
47

  
48
  # Log disallowed deprecations.
49
  config.active_support.disallowed_deprecation = :log
50

  
51
  # Tell Active Support which deprecation messages to disallow.
52
  config.active_support.disallowed_deprecation_warnings = []
53

  
54
  # Use default logging formatter so that PID and timestamp are not suppressed.
55
  config.log_formatter = ::Logger::Formatter.new
56

  
57
  # Use a different logger for distributed setups.
58
  # require "syslog/logger"
59
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
60

  
61
  if ENV["RAILS_LOG_TO_STDOUT"].present?
62
    logger           = ActiveSupport::Logger.new(STDOUT)
63
    logger.formatter = config.log_formatter
64
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
65
  end
66

  
67
  # Do not dump schema after migrations.
68
  config.active_record.dump_schema_after_migration = false
69

  
70
  # Inserts middleware to perform automatic connection switching.
71
  # The `database_selector` hash is used to pass options to the DatabaseSelector
72
  # middleware. The `delay` is used to determine how long to wait after a write
73
  # to send a subsequent read to the primary.
74
  #
75
  # The `database_resolver` class is used by the middleware to determine which
76
  # database is appropriate to use based on the time delay.
77
  #
78
  # The `database_resolver_context` class is used by the middleware to set
79
  # timestamps for the last write to the primary. The resolver uses the context
80
  # class timestamps to determine how long to wait before reading from the
81
  # replica.
82
  #
83
  # By default Rails will store a last write timestamp in the session. The
84
  # DatabaseSelector middleware is designed as such you can define your own
85
  # strategy for connection switching and pass that into the middleware through
86
  # these configuration options.
87
  # config.active_record.database_selector = { delay: 2.seconds }
88
  # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
89
  # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
90

  
19 91
  # Disable delivery errors
20 92
  config.action_mailer.raise_delivery_errors = false
21 93

  
22 94
  # No email in production log
23 95
  config.action_mailer.logger = nil
24

  
25
  # Print deprecation notices to the Rails logger.
26
  config.active_support.deprecation = :log
27 96
end
config/environments/test.rb
1 1
# frozen_string_literal: true
2 2

  
3
require 'active_support/core_ext/integer/time'
4

  
5
# The test environment is used exclusively to run your application's
6
# test suite. You never need to work with it otherwise. Remember that
7
# your test database is "scratch space" for the test suite and is wiped
8
# and recreated between test runs. Don't rely on the data there!
9

  
3 10
Rails.application.configure do
4
  # Settings specified here will take precedence over those in config/application.rb
11
  # Settings specified here will take precedence over those in config/application.rb.
5 12

  
6
  # The test environment is used exclusively to run your application's
7
  # test suite.  You never need to work with it otherwise.  Remember that
8
  # your test database is "scratch space" for the test suite and is wiped
9
  # and recreated between test runs.  Don't rely on the data there!
10 13
  config.cache_classes = true
14
  # config.action_view.cache_template_loading = true
11 15

  
12 16
  # Do not eager load code on boot. This avoids loading your whole application
13 17
  # just for the purpose of running a single test. If you are using a tool that
14 18
  # preloads Rails for running tests, you may have to set it to true.
15 19
  config.eager_load = false
16 20

  
17
  # Show full error reports and disable caching
18
  config.consider_all_requests_local = true
21
  # Configure public file server for tests with Cache-Control for performance.
22
  config.public_file_server.enabled = true
23
  config.public_file_server.headers = {
24
    'Cache-Control' => "public, max-age=#{1.hour.to_i}"
25
  }
26

  
27
  # Show full error reports and disable caching.
28
  config.consider_all_requests_local       = true
19 29
  config.action_controller.perform_caching = false
30
  config.cache_store = :null_store
31

  
32
  # Raise exceptions instead of rendering exception templates.
33
  config.action_dispatch.show_exceptions = true
34

  
35
  # Disable request forgery protection in test environment.
36
  config.action_controller.allow_forgery_protection = false
37

  
38
  # Disable sessions verifications in test environment.
39
  config.redmine_verify_sessions = false
40

  
41
  # Store uploaded files on the local file system in a temporary directory.
42
  # config.active_storage.service = :test
43

  
44
  config.action_mailer.perform_caching = false
20 45

  
21 46
  config.action_mailer.perform_deliveries = true
22 47

  
......
28 53
  # Disable Async delivery
29 54
  config.active_job.queue_adapter = :inline
30 55

  
31
  # Disable request forgery protection in test environment.
32
  config.action_controller.allow_forgery_protection = false
33

  
34
  # Disable sessions verifications in test environment.
35
  config.redmine_verify_sessions = false
36

  
37
  # Print deprecation notices to stderr and the Rails logger.
56
  # Print deprecation notices to the stderr.
38 57
  config.active_support.deprecation = [:stderr, :log]
39 58

  
40
  config.secret_key_base = 'a secret token for running the tests'
59
  # Raise exceptions for disallowed deprecations.
60
  config.active_support.disallowed_deprecation = :raise
61

  
62
  # Tell Active Support which deprecation messages to disallow.
63
  config.active_support.disallowed_deprecation_warnings = []
41 64

  
42 65
  config.active_support.test_order = :random
66

  
67
  # Raises error for missing translations.
68
  # config.i18n.raise_on_missing_translations = true
69

  
70
  # Annotate rendered view with file names.
71
  # config.action_view.annotate_rendered_view_with_filenames = true
72

  
73
  config.secret_key_base = 'a secret token for running the tests'
43 74
end
(4-4/4)