2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-10 07:22:35 -04:00
|
|
|
require_relative "boot"
|
|
|
|
|
2019-10-23 00:26:35 -04:00
|
|
|
require "rails"
|
2022-10-10 07:22:35 -04:00
|
|
|
# Pick the frameworks you want:
|
|
|
|
require "active_model/railtie"
|
|
|
|
require "active_job/railtie"
|
2019-10-23 00:26:35 -04:00
|
|
|
require "active_record/railtie"
|
2022-10-10 07:22:35 -04:00
|
|
|
# require "active_storage/engine"
|
2019-10-23 00:26:35 -04:00
|
|
|
require "action_controller/railtie"
|
|
|
|
require "action_mailer/railtie"
|
2022-10-10 07:22:35 -04:00
|
|
|
# require "action_mailbox/engine"
|
|
|
|
# require "action_text/engine"
|
|
|
|
require "action_view/railtie"
|
|
|
|
# require "action_cable/engine"
|
2019-10-23 00:26:35 -04:00
|
|
|
require "rails/test_unit/railtie"
|
2011-05-24 18:04:25 -04:00
|
|
|
|
2022-10-10 07:22:35 -04:00
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
2018-04-02 13:51:26 -04:00
|
|
|
Bundler.require(*Rails.groups)
|
2010-02-04 15:08:49 -05:00
|
|
|
|
2018-01-28 17:49:24 -05:00
|
|
|
require_relative "danbooru_default_config"
|
|
|
|
require_relative "danbooru_local_config"
|
|
|
|
|
2010-02-06 16:48:40 -05:00
|
|
|
module Danbooru
|
2010-02-04 15:08:49 -05:00
|
|
|
class Application < Rails::Application
|
2018-04-02 13:51:26 -04:00
|
|
|
# Initialize configuration defaults for originally generated Rails version.
|
2024-01-30 10:18:26 -05:00
|
|
|
config.load_defaults 7.1
|
2024-01-27 07:49:57 -05:00
|
|
|
|
|
|
|
# https://github.com/rails/rails/issues/50897
|
|
|
|
config.active_record.raise_on_assign_to_attr_readonly = false
|
|
|
|
|
2024-01-25 16:05:29 -05:00
|
|
|
# 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))
|
|
|
|
|
2011-07-16 20:16:34 -04:00
|
|
|
config.active_record.schema_format = :sql
|
2018-05-10 14:18:02 -04:00
|
|
|
config.log_tags = [->(req) {"PID:#{Process.pid}"}]
|
2018-04-02 13:51:26 -04:00
|
|
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
2018-01-28 20:57:45 -05:00
|
|
|
config.force_ssl = true
|
2019-02-17 05:01:12 -05:00
|
|
|
config.active_job.queue_adapter = :sidekiq
|
2018-01-28 20:57:45 -05:00
|
|
|
|
|
|
|
if Rails.env.production? && Danbooru.config.ssl_options.present?
|
|
|
|
config.ssl_options = Danbooru.config.ssl_options
|
|
|
|
else
|
|
|
|
config.ssl_options = {
|
|
|
|
hsts: false,
|
|
|
|
secure_cookies: false,
|
|
|
|
redirect: { exclude: ->(request) { true } }
|
|
|
|
}
|
|
|
|
end
|
2016-09-07 21:45:21 -04:00
|
|
|
|
2017-02-18 04:03:45 -05:00
|
|
|
config.after_initialize do
|
|
|
|
Rails.application.routes.default_url_options = {
|
|
|
|
host: Danbooru.config.hostname,
|
|
|
|
}
|
|
|
|
end
|
2014-04-25 13:55:36 -04:00
|
|
|
|
2022-10-10 07:22:35 -04:00
|
|
|
config.i18n.enforce_available_locales = false
|
|
|
|
|
|
|
|
# Configuration for the application, engines, and railties goes here.
|
|
|
|
#
|
|
|
|
# These settings can be overridden in specific environments using the files
|
|
|
|
# in config/environments, which are processed later.
|
|
|
|
#
|
|
|
|
# config.time_zone = "Central Time (US & Canada)"
|
|
|
|
# config.eager_load_paths << Rails.root.join("extras")
|
|
|
|
end
|
2010-02-04 15:08:49 -05:00
|
|
|
end
|