rails 8.0.2 to 8.1. lograte for logging.
This commit is contained in:
parent
4e0858ccbe
commit
9236af0712
20 changed files with 536 additions and 321 deletions
|
|
@ -1,6 +1,6 @@
|
|||
require_relative "boot"
|
||||
require_relative 'boot'
|
||||
|
||||
require "rails/all"
|
||||
require 'rails/all'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
|
|
@ -8,12 +8,7 @@ Bundler.require(*Rails.groups)
|
|||
|
||||
module Debshots
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 8.0
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||
config.autoload_lib(ignore: %w[assets tasks])
|
||||
|
||||
# Configuration for the application, engines, and railties goes here.
|
||||
|
|
|
|||
23
config/ci.rb
Normal file
23
config/ci.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Run using bin/ci
|
||||
|
||||
CI.run do
|
||||
step "Setup", "bin/setup --skip-server"
|
||||
|
||||
step "Style: Ruby", "bin/rubocop"
|
||||
|
||||
step "Security: Importmap vulnerability audit", "bin/importmap audit"
|
||||
step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
|
||||
step "Tests: Rails", "bin/rails test"
|
||||
step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
|
||||
|
||||
# Optional: Run system tests
|
||||
# step "Tests: System", "bin/rails test:system"
|
||||
|
||||
# Optional: set a green GitHub commit status to unblock PR merge.
|
||||
# Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
|
||||
# if success?
|
||||
# step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
|
||||
# else
|
||||
# failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
|
||||
# end
|
||||
end
|
||||
|
|
@ -17,17 +17,16 @@ Rails.application.configure do
|
|||
|
||||
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
||||
# Run rails dev:cache to toggle Action Controller caching.
|
||||
# if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
# config.action_controller.perform_caching = true
|
||||
# config.action_controller.enable_fragment_cache_logging = true
|
||||
# config.public_file_server.headers = { 'cache-control' => "public, max-age=#{2.days.to_i}" }
|
||||
# else
|
||||
# config.action_controller.perform_caching = false
|
||||
# end
|
||||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
config.public_file_server.headers = { 'cache-control' => "public, max-age=#{2.days.to_i}" }
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
end
|
||||
|
||||
# Change to :null_store to avoid any caching.
|
||||
# config.cache_store = :memory_store
|
||||
config.cache_store = :null_store
|
||||
config.cache_store = :memory_store
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = :local
|
||||
|
|
@ -65,11 +64,23 @@ Rails.application.configure do
|
|||
# Highlight code that enqueued background job in logs.
|
||||
config.active_job.verbose_enqueue_logs = true
|
||||
|
||||
# Highlight code that triggered redirect in logs.
|
||||
config.action_dispatch.verbose_redirect_logs = true
|
||||
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
|
|
@ -96,18 +107,9 @@ Rails.application.configure do
|
|||
# TODO: put it into the database and make it configurable online
|
||||
config.alert_message = ENV['DEBSHOTS_ALERT_MESSAGE']
|
||||
|
||||
# URL to fetch reviews from the Ubuntu JSON API
|
||||
# config.ubuntu_reviews_api_url = 'https://reviews.ubuntu.com/reviews/api/1.0/reviews/filter/en/any/any/any/%s'
|
||||
|
||||
# Needed (at least) for devise.rb to determine the oauth2 callback URL
|
||||
config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000'
|
||||
|
||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ Rails.application.configure do
|
|||
config.active_storage.service = :local
|
||||
|
||||
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||
config.assume_ssl = true
|
||||
# config.assume_ssl = true
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = true
|
||||
# config.force_ssl = true
|
||||
|
||||
# Skip http-to-https redirect for the default health check endpoint.
|
||||
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
||||
|
|
@ -37,7 +37,16 @@ Rails.application.configure do
|
|||
config.log_tags = [:request_id]
|
||||
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
||||
|
||||
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
||||
# Lograge - structured request logging
|
||||
config.lograge.enabled = true
|
||||
config.lograge.custom_options = lambda do |event|
|
||||
{
|
||||
request_id: event.payload[:request_id],
|
||||
user_id: event.payload[:user_id]
|
||||
}
|
||||
end
|
||||
|
||||
# Change to "debug" to log everything (including potentially personally-identifiable information!).
|
||||
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
|
||||
|
||||
# Prevent health checks from clogging up the logs.
|
||||
|
|
@ -47,20 +56,10 @@ Rails.application.configure do
|
|||
config.active_support.report_deprecations = false
|
||||
|
||||
# Replace the default in-process memory cache store with a durable alternative.
|
||||
# config.cache_store = :solid_cache_store
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Replace the default in-process and non-durable queuing backend for Active Job.
|
||||
# config.active_job.queue_adapter = :solid_queue
|
||||
# config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||
config.action_mailer.smtp_settings = {
|
||||
address: ENV['SMTP_SERVER'],
|
||||
port: 25,
|
||||
enable_starttls_auto: false
|
||||
}
|
||||
config.action_mailer.default_url_options = {
|
||||
host: 'screenshots.debian.net',
|
||||
protocol: 'https'
|
||||
}
|
||||
# config.active_job.queue_adapter = :resque
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
|
|
@ -69,7 +68,7 @@ Rails.application.configure do
|
|||
# Set host to be used by links generated in mailer templates.
|
||||
config.action_mailer.default_url_options = { host: 'example.com' }
|
||||
|
||||
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
||||
# Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
|
||||
# config.action_mailer.smtp_settings = {
|
||||
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
||||
# password: Rails.application.credentials.dig(:smtp, :password),
|
||||
|
|
@ -85,6 +84,18 @@ Rails.application.configure do
|
|||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
# Only use :id for inspections in production.
|
||||
config.active_record.attributes_for_inspect = [:id]
|
||||
|
||||
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||
# config.hosts = [
|
||||
# "example.com", # Allow requests from example.com
|
||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||
# ]
|
||||
#
|
||||
# Skip DNS rebinding protection for the default health check endpoint.
|
||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||
|
||||
# Let the "thrust" web server handle sending images. It allows to route all
|
||||
# images through the Rails application and prevent unauthorized access to
|
||||
# images that are pending moderation. (A common problem with spammers uploading
|
||||
|
|
@ -106,23 +117,6 @@ Rails.application.configure do
|
|||
# TODO: put it into the database and make it configurable online
|
||||
config.alert_message = ENV['DEBSHOTS_ALERT_MESSAGE']
|
||||
|
||||
# URL to fetch reviews from the Ubuntu JSON API
|
||||
# config.ubuntu_reviews_api_url = 'https://reviews.ubuntu.com/reviews/api/1.0/reviews/filter/en/any/any/any/%s'
|
||||
|
||||
# Any action dealing with authentication should redirect to HTTPS
|
||||
# Disabled because it will redirect incorrectly behind a proxy.
|
||||
# config.to_prepare { Devise::SessionsController.force_ssl }
|
||||
# Only use :id for inspections in production.
|
||||
# Needed (at least) for devise.rb to determine the oauth2 callback URL
|
||||
config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000'
|
||||
config.active_record.attributes_for_inspect = [:id]
|
||||
|
||||
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||
# config.hosts = [
|
||||
# "example.com", # Allow requests from example.com
|
||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||
# ]
|
||||
#
|
||||
# Skip DNS rebinding protection for the default health check endpoint.
|
||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,10 +62,8 @@ Rails.application.configure do
|
|||
|
||||
config.alert_message = ENV['DEBSHOTS_ALERT_MESSAGE']
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
config.base_url = ENV['DEBSHOTS_BASE_URL'] || 'http://localhost:3000'
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
# Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
||||
#
|
||||
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
|
||||
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
|
||||
# # config.content_security_policy_nonce_auto = true
|
||||
#
|
||||
# # Report violations without enforcing the policy.
|
||||
# # config.content_security_policy_report_only = true
|
||||
# end
|
||||
|
|
|
|||
74
config/initializers/new_framework_defaults_8_1.rb
Normal file
74
config/initializers/new_framework_defaults_8_1.rb
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file eases your Rails 8.1 framework defaults upgrade.
|
||||
#
|
||||
# Uncomment each configuration one by one to switch to the new default.
|
||||
# Once your application is ready to run with all new defaults, you can remove
|
||||
# this file and set the `config.load_defaults` to `8.1`.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||
|
||||
###
|
||||
# Skips escaping HTML entities and line separators. When set to `false`, the
|
||||
# JSON renderer no longer escapes these to improve performance.
|
||||
#
|
||||
# Example:
|
||||
# class PostsController < ApplicationController
|
||||
# def index
|
||||
# render json: { key: "\u2028\u2029<>&" }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# Renders `{"key":"\u2028\u2029\u003c\u003e\u0026"}` with the previous default, but `{"key":"
<>&"}` with the config
|
||||
# set to `false`.
|
||||
#
|
||||
# Applications that want to keep the escaping behavior can set the config to `true`.
|
||||
#++
|
||||
# Rails.configuration.action_controller.escape_json_responses = false
|
||||
|
||||
###
|
||||
# Skips escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
|
||||
#
|
||||
# Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
|
||||
# As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
|
||||
#++
|
||||
# Rails.configuration.active_support.escape_js_separators_in_json = false
|
||||
|
||||
###
|
||||
# Raises an error when order dependent finder methods (e.g. `#first`, `#second`) are called without `order` values
|
||||
# on the relation, and the model does not have any order columns (`implicit_order_column`, `query_constraints`, or
|
||||
# `primary_key`) to fall back on.
|
||||
#
|
||||
# The current behavior of not raising an error has been deprecated, and this configuration option will be removed in
|
||||
# Rails 8.2.
|
||||
#++
|
||||
# Rails.configuration.active_record.raise_on_missing_required_finder_order_columns = true
|
||||
|
||||
###
|
||||
# Controls how Rails handles path relative URL redirects.
|
||||
# When set to `:raise`, Rails will raise an `ActionController::Redirecting::UnsafeRedirectError`
|
||||
# for relative URLs without a leading slash, which can help prevent open redirect vulnerabilities.
|
||||
#
|
||||
# Example:
|
||||
# redirect_to "example.com" # Raises UnsafeRedirectError
|
||||
# redirect_to "@attacker.com" # Raises UnsafeRedirectError
|
||||
# redirect_to "/safe/path" # Works correctly
|
||||
#
|
||||
# Applications that want to allow these redirects can set the config to `:log` (previous default)
|
||||
# to only log warnings, or `:notify` to send ActiveSupport notifications.
|
||||
#++
|
||||
# Rails.configuration.action_controller.action_on_path_relative_redirect = :raise
|
||||
|
||||
###
|
||||
# Use a Ruby parser to track dependencies between Action View templates
|
||||
#++
|
||||
# Rails.configuration.action_view.render_tracker = :ruby
|
||||
|
||||
###
|
||||
# When enabled, hidden inputs generated by `form_tag`, `token_tag`, `method_tag`, and the hidden parameter fields
|
||||
# included in `button_to` forms will omit the `autocomplete="off"` attribute.
|
||||
#
|
||||
# Applications that want to keep generating the `autocomplete` attribute for those tags can set it to `false`.
|
||||
#++
|
||||
# Rails.configuration.action_view.remove_hidden_field_autocomplete = true
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
#
|
||||
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
||||
# should only set this value when you want to run 2 or more workers. The
|
||||
# default is already 1.
|
||||
# default is already 1. You can set it to `auto` to automatically start a worker
|
||||
# for each available processor.
|
||||
#
|
||||
# The ideal number of threads per worker depends both on how much time the
|
||||
# application spends waiting for IO operations and on how much you wish to
|
||||
|
|
@ -24,18 +25,18 @@
|
|||
# Any libraries that use a connection pool or another resource pool should
|
||||
# be configured to provide at least as many connections as the number of
|
||||
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
||||
threads_count = ENV.fetch('RAILS_MAX_THREADS', 3)
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
port ENV.fetch('PORT', 3000)
|
||||
port ENV.fetch("PORT", 3000)
|
||||
|
||||
# Allow puma to be restarted by `bin/rails restart` command.
|
||||
plugin :tmp_restart
|
||||
|
||||
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
||||
# plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||
# Run the Solid Queue supervisor inside of Puma for single-server deployments.
|
||||
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||
|
||||
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
||||
# In other environments, only set the PID file if requested.
|
||||
pidfile ENV['PIDFILE'] if ENV['PIDFILE']
|
||||
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue