2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-29 04:57:47 +00:00
moebooru/config/application.rb

61 lines
2.3 KiB
Ruby
Raw Normal View History

2024-01-08 19:39:01 +09:00
require_relative "boot"
2024-09-01 05:00:14 +09:00
# To allow setting environment variable MB_DATABASE_URL instead of DATABASE_URL.
2024-01-08 19:39:01 +09:00
ENV["DATABASE_URL"] = ENV["MB_DATABASE_URL"] if ENV["MB_DATABASE_URL"]
ENV["NODE_ENV"] = ENV["RAILS_ENV"]
2024-01-08 19:39:01 +09:00
require "rails/all"
2012-05-08 04:30:49 +00:00
2024-01-08 19:39:01 +09:00
require_relative "init_config"
2012-12-11 21:15:45 +07:00
2024-09-01 05:00:14 +09:00
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
2024-01-08 19:39:01 +09:00
Bundler.require(*CONFIG["bundler_groups"])
2012-05-08 04:30:49 +00:00
module Moebooru
class Application < Rails::Application
2024-09-01 05:00:14 +09:00
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2
# 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.
#
# 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")
2012-06-04 17:24:00 +07:00
2015-06-27 16:03:34 +09:00
config.i18n.available_locales = CONFIG["available_locales"]
config.i18n.default_locale = CONFIG["default_locale"]
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
if CONFIG["memcache_servers"]
2021-02-11 16:57:35 +09:00
config.cache_store = :mem_cache_store, CONFIG["memcache_servers"], {
2024-01-08 19:39:01 +09:00
namespace: CONFIG["app_name"],
pool_size: CONFIG["threads"],
value_max_bytes: 2_000_000
2016-11-09 06:04:35 +09:00
}
end
# This one is never reliable because there's no standard controlling this.
config.action_dispatch.ip_spoofing_check = false
2012-12-11 21:10:35 +07:00
scheme = "#{CONFIG['secure'] ? 'https' : 'http'}://"
config.action_controller.asset_host = "#{scheme}#{CONFIG[:file_hosts][:assets]}" if CONFIG[:file_hosts]
2024-01-08 19:39:01 +09:00
config.action_mailer.default_url_options = { host: "#{scheme}#{CONFIG["server_host"]}" }
2019-08-17 17:03:16 +09:00
config.middleware.delete ActionDispatch::HostAuthorization
2024-09-01 05:00:14 +09:00
config.active_record.belongs_to_required_by_default = false
2012-05-08 04:30:49 +00:00
end
end