2019-03-26 15:32:20 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-02 17:19:25 +00:00
|
|
|
require_relative 'boot'
|
|
|
|
|
2019-03-26 15:32:20 +00:00
|
|
|
require 'rails'
|
2018-01-02 17:19:25 +00:00
|
|
|
# Pick the frameworks you want:
|
2019-03-26 15:32:20 +00:00
|
|
|
require 'active_model/railtie'
|
|
|
|
require 'active_job/railtie'
|
|
|
|
require 'active_record/railtie'
|
2019-08-29 17:54:19 +00:00
|
|
|
require 'active_storage/engine'
|
2019-03-26 15:32:20 +00:00
|
|
|
require 'action_controller/railtie'
|
|
|
|
require 'action_mailer/railtie'
|
2019-11-07 16:09:01 +00:00
|
|
|
# require 'action_mailbox/engine'
|
2019-08-29 17:54:19 +00:00
|
|
|
require 'action_text/engine'
|
2019-03-26 15:32:20 +00:00
|
|
|
require 'action_view/railtie'
|
2018-01-02 17:19:25 +00:00
|
|
|
# require "action_cable/engine"
|
2019-03-26 15:32:20 +00:00
|
|
|
require 'sprockets/railtie'
|
|
|
|
require 'rails/test_unit/railtie'
|
2018-01-02 17:19:25 +00:00
|
|
|
|
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
|
|
|
Bundler.require(*Rails.groups)
|
|
|
|
|
|
|
|
module Sutty
|
2019-07-12 17:11:24 +00:00
|
|
|
# Sutty!
|
2018-01-02 17:19:25 +00:00
|
|
|
class Application < Rails::Application
|
2019-07-12 17:11:24 +00:00
|
|
|
# Initialize configuration defaults for originally generated Rails
|
|
|
|
# version.
|
2020-12-24 18:02:03 +00:00
|
|
|
config.load_defaults 6.1
|
2018-01-02 17:19:25 +00:00
|
|
|
|
2019-07-12 17:11:24 +00:00
|
|
|
# Settings in config/environments/* take precedence over those
|
2019-08-29 17:54:19 +00:00
|
|
|
# specified here. Application configuration can go into files in
|
2019-07-12 17:11:24 +00:00
|
|
|
# config/initializers -- all .rb files in that directory are
|
2019-08-29 17:54:19 +00:00
|
|
|
# automatically loaded after loading the framework and any gems in
|
|
|
|
# your application.
|
2019-07-12 17:11:24 +00:00
|
|
|
config.action_dispatch
|
|
|
|
.rescue_responses['Pundit::NotAuthorizedError'] = :forbidden
|
2019-08-22 01:09:29 +00:00
|
|
|
|
|
|
|
config.active_storage.variant_processor = :vips
|
2023-04-10 21:22:49 +00:00
|
|
|
config.active_storage.web_image_content_types << 'image/webp'
|
2021-02-24 20:25:37 +00:00
|
|
|
|
2023-03-29 00:15:55 +00:00
|
|
|
# Que
|
|
|
|
config.action_mailer.deliver_later_queue_name = :default
|
|
|
|
config.active_storage.queues.analysis = :default
|
|
|
|
config.active_storage.queues.purge = :default
|
|
|
|
config.active_job.queue_adapter = :que
|
|
|
|
|
2023-05-16 16:38:49 +00:00
|
|
|
config.active_record.schema_format = :sql
|
|
|
|
|
2022-03-04 22:05:11 +00:00
|
|
|
config.to_prepare do
|
2022-03-04 22:17:03 +00:00
|
|
|
Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c|
|
2022-03-04 22:05:11 +00:00
|
|
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-24 20:25:37 +00:00
|
|
|
config.after_initialize do
|
2021-02-28 14:00:48 +00:00
|
|
|
ActiveStorage::DirectUploadsController.include ActiveStorage::AuthenticatedDirectUploadsController
|
|
|
|
|
2021-02-24 20:25:37 +00:00
|
|
|
I18n.available_locales.each do |locale|
|
|
|
|
translations = I18n.t(:email_address, locale: locale)
|
|
|
|
|
|
|
|
next unless translations.is_a? Hash
|
|
|
|
|
|
|
|
EmailAddress::Config.error_messages translations.transform_keys(&:to_s), locale.to_s
|
|
|
|
end
|
|
|
|
end
|
2022-04-06 22:05:50 +00:00
|
|
|
|
|
|
|
def nodes
|
2022-04-11 16:37:38 +00:00
|
|
|
@nodes ||= ENV.fetch('SUTTY_NODES', 'anarres.sutty.nl').split(',')
|
2022-04-06 22:05:50 +00:00
|
|
|
end
|
2018-01-02 17:19:25 +00:00
|
|
|
end
|
|
|
|
end
|