easymon 1.6.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -12
  3. data/Rakefile +1 -1
  4. data/app/controllers/easymon/checks_controller.rb +6 -6
  5. data/config/routes.rb +2 -2
  6. data/lib/easymon/checklist.rb +7 -7
  7. data/lib/easymon/checks/active_record_check.rb +5 -5
  8. data/lib/easymon/checks/active_record_mysql_writeable_check.rb +1 -1
  9. data/lib/easymon/checks/http_check.rb +6 -6
  10. data/lib/easymon/checks/memcached_check.rb +6 -6
  11. data/lib/easymon/checks/multi_active_record_check.rb +52 -0
  12. data/lib/easymon/checks/redis_check.rb +3 -3
  13. data/lib/easymon/checks/redis_writeable_check.rb +1 -1
  14. data/lib/easymon/checks/semaphore_check.rb +6 -6
  15. data/lib/easymon/checks/split_active_record_check.rb +6 -16
  16. data/lib/easymon/checks/traffic_enabled_check.rb +2 -2
  17. data/lib/easymon/engine.rb +1 -1
  18. data/lib/easymon/repository.rb +5 -5
  19. data/lib/easymon/result.rb +2 -2
  20. data/lib/easymon/testing.rb +2 -2
  21. data/lib/easymon/version.rb +1 -1
  22. data/lib/easymon.rb +10 -9
  23. data/test/controllers/easymon/checks_controller_test.rb +10 -11
  24. data/test/dummy/Rakefile +2 -3
  25. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  26. data/test/dummy/app/controllers/application_controller.rb +2 -1
  27. data/test/dummy/app/jobs/application_job.rb +7 -0
  28. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  29. data/test/dummy/app/models/application_record.rb +3 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +22 -9
  31. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  32. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  33. data/test/dummy/app/views/pwa/manifest.json.erb +22 -0
  34. data/test/dummy/app/views/pwa/service-worker.js +26 -0
  35. data/test/dummy/bin/dev +2 -0
  36. data/test/dummy/bin/rails +4 -0
  37. data/test/dummy/bin/rake +4 -0
  38. data/test/dummy/bin/setup +34 -0
  39. data/test/dummy/config/application.rb +22 -50
  40. data/test/dummy/config/boot.rb +4 -9
  41. data/test/dummy/config/database.yml +25 -6
  42. data/test/dummy/config/environment.rb +4 -4
  43. data/test/dummy/config/environments/development.rb +55 -25
  44. data/test/dummy/config/environments/production.rb +64 -42
  45. data/test/dummy/config/environments/test.rb +35 -25
  46. data/test/dummy/config/initializers/assets.rb +7 -0
  47. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  48. data/test/dummy/config/initializers/easymon.rb +2 -2
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  50. data/test/dummy/config/initializers/inflections.rb +10 -9
  51. data/test/dummy/config/locales/en.yml +28 -2
  52. data/test/dummy/config/puma.rb +38 -0
  53. data/test/dummy/config/redis.yml +5 -6
  54. data/test/dummy/config/routes.rb +13 -0
  55. data/test/dummy/config/storage.yml +34 -0
  56. data/test/dummy/config.ru +4 -2
  57. data/test/dummy/public/400.html +114 -0
  58. data/test/dummy/public/404.html +113 -25
  59. data/test/dummy/public/406-unsupported-browser.html +114 -0
  60. data/test/dummy/public/422.html +113 -25
  61. data/test/dummy/public/500.html +113 -24
  62. data/test/dummy/public/icon.png +0 -0
  63. data/test/dummy/public/icon.svg +3 -0
  64. data/test/dummy/tmp/local_secret.txt +1 -0
  65. data/test/helpers/easymon/checks_helper_test.rb +1 -1
  66. data/test/integration/navigation_test.rb +1 -2
  67. data/test/test_helper.rb +3 -3
  68. data/test/unit/checklist_test.rb +5 -5
  69. data/test/unit/checks/active_record_check_on_postgresql_test.rb +1 -2
  70. data/test/unit/checks/active_record_check_test.rb +1 -2
  71. data/test/unit/checks/active_record_mysql_writeable_check_test.rb +2 -3
  72. data/test/unit/checks/http_check_test.rb +3 -3
  73. data/test/unit/checks/memcached_check_test.rb +6 -8
  74. data/test/unit/checks/multi_active_record_check_test.rb +73 -0
  75. data/test/unit/checks/redis_check_test.rb +8 -9
  76. data/test/unit/checks/redis_writeable_check_test.rb +2 -3
  77. data/test/unit/checks/semaphore_check_test.rb +2 -3
  78. data/test/unit/checks/split_active_record_check_test.rb +9 -24
  79. data/test/unit/checks/traffic_enabled_check_test.rb +2 -3
  80. data/test/unit/repository_test.rb +2 -3
  81. metadata +99 -75
  82. data/test/dummy/README.rdoc +0 -261
  83. data/test/dummy/app/assets/javascripts/application.js +0 -15
  84. data/test/dummy/app/assets/javascripts/easymon.js +0 -2
  85. data/test/dummy/app/assets/stylesheets/easymon.css +0 -4
  86. data/test/dummy/app/controllers/easymon_controller.rb +0 -7
  87. data/test/dummy/app/helpers/easymon_helper.rb +0 -2
  88. data/test/dummy/app/views/easymon/index.html.erb +0 -2
  89. data/test/dummy/app/views/easymon/show.html.erb +0 -2
  90. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  91. data/test/dummy/config/initializers/mime_types.rb +0 -5
  92. data/test/dummy/config/initializers/secret_token.rb +0 -7
  93. data/test/dummy/config/initializers/session_store.rb +0 -8
  94. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  95. data/test/dummy/public/favicon.ico +0 -0
  96. data/test/dummy/script/rails +0 -6
  97. /data/test/dummy/{app/assets/config/manifest.js → log/test.log} +0 -0
data/test/dummy/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- #!/usr/bin/env rake
2
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
3
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
3
 
5
- require File.expand_path('../config/application', __FILE__)
4
+ require_relative "config/application"
6
5
 
7
- Dummy::Application.load_tasks
6
+ Rails.application.load_tasks
@@ -3,11 +3,13 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
10
12
  *
11
- *= require_self
12
13
  *= require_tree .
14
+ *= require_self
13
15
  */
@@ -1,3 +1,4 @@
1
1
  class ApplicationController < ActionController::Base
2
- protect_from_forgery
2
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3
+ allow_browser versions: :modern
3
4
  end
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
@@ -1,14 +1,27 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
3
+ <head>
4
+ <title><%= content_for(:title) || "Dummy" %></title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <meta name="mobile-web-app-capable" content="yes">
8
+ <%= csrf_meta_tags %>
9
+ <%= csp_meta_tag %>
10
10
 
11
- <%= yield %>
11
+ <%= yield :head %>
12
12
 
13
- </body>
13
+ <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
14
+ <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
15
+
16
+ <link rel="icon" href="/icon.png" type="image/png">
17
+ <link rel="icon" href="/icon.svg" type="image/svg+xml">
18
+ <link rel="apple-touch-icon" href="/icon.png">
19
+
20
+ <%# Includes all stylesheet files in app/assets/stylesheets %>
21
+ <%= stylesheet_link_tag :app %>
22
+ </head>
23
+
24
+ <body>
25
+ <%= yield %>
26
+ </body>
14
27
  </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "Dummy",
3
+ "icons": [
4
+ {
5
+ "src": "/icon.png",
6
+ "type": "image/png",
7
+ "sizes": "512x512"
8
+ },
9
+ {
10
+ "src": "/icon.png",
11
+ "type": "image/png",
12
+ "sizes": "512x512",
13
+ "purpose": "maskable"
14
+ }
15
+ ],
16
+ "start_url": "/",
17
+ "display": "standalone",
18
+ "scope": "/",
19
+ "description": "Dummy.",
20
+ "theme_color": "red",
21
+ "background_color": "red"
22
+ }
@@ -0,0 +1,26 @@
1
+ // Add a service worker for processing Web Push notifications:
2
+ //
3
+ // self.addEventListener("push", async (event) => {
4
+ // const { title, options } = await event.data.json()
5
+ // event.waitUntil(self.registration.showNotification(title, options))
6
+ // })
7
+ //
8
+ // self.addEventListener("notificationclick", function(event) {
9
+ // event.notification.close()
10
+ // event.waitUntil(
11
+ // clients.matchAll({ type: "window" }).then((clientList) => {
12
+ // for (let i = 0; i < clientList.length; i++) {
13
+ // let client = clientList[i]
14
+ // let clientPath = (new URL(client.url)).pathname
15
+ //
16
+ // if (clientPath == event.notification.data.path && "focus" in client) {
17
+ // return client.focus()
18
+ // }
19
+ // }
20
+ //
21
+ // if (clients.openWindow) {
22
+ // return clients.openWindow(event.notification.data.path)
23
+ // }
24
+ // })
25
+ // )
26
+ // })
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ exec "./bin/rails", "server", *ARGV
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ APP_ROOT = File.expand_path("..", __dir__)
5
+
6
+ def system!(*args)
7
+ system(*args, exception: true)
8
+ end
9
+
10
+ FileUtils.chdir APP_ROOT do
11
+ # This script is a way to set up or update your development environment automatically.
12
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
13
+ # Add necessary setup steps to this file.
14
+
15
+ puts "== Installing dependencies =="
16
+ system("bundle check") || system!("bundle install")
17
+
18
+ # puts "\n== Copying sample files =="
19
+ # unless File.exist?("config/database.yml")
20
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
21
+ # end
22
+
23
+ puts "\n== Preparing database =="
24
+ system! "bin/rails db:prepare"
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! "bin/rails log:clear tmp:clear"
28
+
29
+ unless ARGV.include?("--skip-server")
30
+ puts "\n== Starting development server =="
31
+ STDOUT.flush # flush the output before exec(2) so that it displays
32
+ exec "bin/dev"
33
+ end
34
+ end
@@ -1,59 +1,31 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative "boot"
2
2
 
3
- require 'rails/all'
3
+ require "rails/all"
4
4
 
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
5
7
  Bundler.require(*Rails.groups)
8
+
6
9
  require "easymon"
7
10
 
8
11
  module Dummy
9
12
  class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
- # config.time_zone = 'Central Time (US & Canada)'
27
-
28
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
- # config.i18n.default_locale = :de
31
-
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- # config.active_record.whitelist_attributes = true
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
13
+ config.load_defaults Rails::VERSION::STRING.to_f
14
+
15
+ # For compatibility with applications that use this config
16
+ config.action_controller.include_all_helpers = false
17
+
18
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
19
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
20
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
21
+ config.autoload_lib(ignore: %w[assets tasks])
22
+
23
+ # Configuration for the application, engines, and railties goes here.
24
+ #
25
+ # These settings can be overridden in specific environments using the files
26
+ # in config/environments, which are processed later.
27
+ #
28
+ # config.time_zone = "Central Time (US & Canada)"
29
+ # config.eager_load_paths << Rails.root.join("extras")
57
30
  end
58
31
  end
59
-
@@ -1,10 +1,5 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ # Set up gems listed in the Gemfile.
2
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
3
3
 
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
4
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
5
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -10,12 +10,31 @@ development:
10
10
  # re-generated from your development database when you run "rake".
11
11
  # Do not set this db to the same as development or production.
12
12
  test:
13
- adapter: mysql2
14
- encoding: utf8
15
- database: dummy_test
16
- username: root
17
- host: 127.0.0.1
18
- port: 3306
13
+ primary:
14
+ adapter: mysql2
15
+ encoding: utf8
16
+ database: dummy_test
17
+ username: root
18
+ host: 127.0.0.1
19
+ port: 3306
20
+
21
+ primary_replica:
22
+ adapter: mysql2
23
+ encoding: utf8
24
+ database: dummy_test
25
+ username: root
26
+ host: 127.0.0.1
27
+ port: 3306
28
+ replica: true
29
+
30
+ other_replica:
31
+ adapter: mysql2
32
+ encoding: utf8
33
+ database: dummy_test
34
+ username: root
35
+ host: 127.0.0.1
36
+ port: 3306
37
+ replica: true
19
38
 
20
39
  test_replica:
21
40
  adapter: mysql2
@@ -1,5 +1,5 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
1
+ # Load the Rails application.
2
+ require_relative "application"
3
3
 
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -1,39 +1,69 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
8
5
 
9
- # Log error messages when you accidentally call methods on nil.
10
- # config.whiny_nils = true
6
+ # Make code changes take effect immediately without server restart.
7
+ config.enable_reloading = true
11
8
 
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
15
11
 
16
- # Don't care if the mailer can't send
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable server timing.
16
+ config.server_timing = true
17
+
18
+ # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19
+ # Run rails dev:cache to toggle Action Controller caching.
20
+ if Rails.root.join("tmp/caching-dev.txt").exist?
21
+ config.action_controller.perform_caching = true
22
+ config.action_controller.enable_fragment_cache_logging = true
23
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
24
+ else
25
+ config.action_controller.perform_caching = false
26
+ end
27
+
28
+ # Change to :null_store to avoid any caching.
29
+ config.cache_store = :memory_store
30
+
31
+ # Store uploaded files on the local file system (see config/storage.yml for options).
32
+ config.active_storage.service = :local
33
+
34
+ # Don't care if the mailer can't send.
17
35
  config.action_mailer.raise_delivery_errors = false
18
36
 
19
- # Print deprecation notices to the Rails logger
37
+ # Make template changes take effect immediately.
38
+ config.action_mailer.perform_caching = false
39
+
40
+ # Set localhost to be used by links generated in mailer templates.
41
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
42
+
43
+ # Print deprecation notices to the Rails logger.
20
44
  config.active_support.deprecation = :log
21
45
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
46
+ # Raise an error on page load if there are pending migrations.
47
+ config.active_record.migration_error = :page_load
48
+
49
+ # Highlight code that triggered database queries in logs.
50
+ config.active_record.verbose_query_logs = true
51
+
52
+ # Append comments with runtime information tags to SQL queries in logs.
53
+ config.active_record.query_log_tags_enabled = true
24
54
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- # config.active_record.mass_assignment_sanitizer = :strict
55
+ # Highlight code that enqueued background job in logs.
56
+ config.active_job.verbose_enqueue_logs = true
27
57
 
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- #config.active_record.auto_explain_threshold_in_seconds = 0.5
58
+ # Raises error for missing translations.
59
+ # config.i18n.raise_on_missing_translations = true
31
60
 
32
- # Do not compress assets
33
- config.assets.compress = false
61
+ # Annotate rendered view with file names.
62
+ config.action_view.annotate_rendered_view_with_filenames = true
34
63
 
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
64
+ # Uncomment if you wish to allow Action Cable access from any origin.
65
+ # config.action_cable.disable_request_forgery_protection = true
37
66
 
38
- config.eager_load = true
67
+ # Raise error when a before_action's only/except options reference missing actions.
68
+ config.action_controller.raise_on_missing_callback_actions = true
39
69
  end
@@ -1,67 +1,89 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
6
5
 
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
6
+ # Code is not reloaded between requests.
7
+ config.enable_reloading = false
8
+
9
+ # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
10
+ config.eager_load = true
10
11
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
12
+ # Full error reports are disabled.
13
+ config.consider_all_requests_local = false
13
14
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
15
+ # Turn on fragment caching in view templates.
16
+ config.action_controller.perform_caching = true
16
17
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
18
+ # Cache assets for far-future expiry since they are all digest stamped.
19
+ config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
19
20
 
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
21
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
22
+ # config.asset_host = "http://assets.example.com"
22
23
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
24
+ # Store uploaded files on the local file system (see config/storage.yml for options).
25
+ config.active_storage.service = :local
25
26
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
27
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
28
+ config.assume_ssl = true
29
29
 
30
30
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
31
+ config.force_ssl = true
32
32
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
33
+ # Skip http-to-https redirect for the default health check endpoint.
34
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
35
35
 
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
36
+ # Log to STDOUT with the current request id as a default log tag.
37
+ config.log_tags = [ :request_id ]
38
+ config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
38
39
 
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
40
+ # Change to "debug" to log everything (including potentially personally-identifiable information!)
41
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
41
42
 
42
- # Use a different cache store in production
43
- # config.cache_store = :mem_cache_store
43
+ # Prevent health checks from clogging up the logs.
44
+ config.silence_healthcheck_path = "/up"
44
45
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
46
+ # Don't log any deprecations.
47
+ config.active_support.report_deprecations = false
47
48
 
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
49
+ # Replace the default in-process memory cache store with a durable alternative.
50
+ # config.cache_store = :mem_cache_store
51
+
52
+ # Replace the default in-process and non-durable queuing backend for Active Job.
53
+ # config.active_job.queue_adapter = :resque
50
54
 
51
- # Disable delivery errors, bad email addresses will be ignored
55
+ # Ignore bad email addresses and do not raise email delivery errors.
56
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
57
  # config.action_mailer.raise_delivery_errors = false
53
58
 
54
- # Enable threaded mode
55
- # config.threadsafe!
59
+ # Set host to be used by links generated in mailer templates.
60
+ config.action_mailer.default_url_options = { host: "example.com" }
61
+
62
+ # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
63
+ # config.action_mailer.smtp_settings = {
64
+ # user_name: Rails.application.credentials.dig(:smtp, :user_name),
65
+ # password: Rails.application.credentials.dig(:smtp, :password),
66
+ # address: "smtp.example.com",
67
+ # port: 587,
68
+ # authentication: :plain
69
+ # }
56
70
 
57
71
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
72
+ # the I18n.default_locale when a translation cannot be found).
59
73
  config.i18n.fallbacks = true
60
74
 
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
75
+ # Do not dump schema after migrations.
76
+ config.active_record.dump_schema_after_migration = false
77
+
78
+ # Only use :id for inspections in production.
79
+ config.active_record.attributes_for_inspect = [ :id ]
63
80
 
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
81
+ # Enable DNS rebinding protection and other `Host` header attacks.
82
+ # config.hosts = [
83
+ # "example.com", # Allow requests from example.com
84
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
85
+ # ]
86
+ #
87
+ # Skip DNS rebinding protection for the default health check endpoint.
88
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
67
89
  end