5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-05-17 23:50:49 +00:00
panel/config/application.rb

94 lines
3.1 KiB
Ruby
Raw Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2018-01-02 17:19:25 +00:00
require_relative 'boot'
2024-02-20 20:18:39 +00:00
require 'aasm'
require 'redis-client'
require 'hiredis-client'
require 'brs'
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)
2024-01-10 20:04:53 +00:00
if %w[development test].include? ENV['RAILS_ENV']
# https://github.com/bkeepers/dotenv/pull/453
Dotenv::Railtie.class_eval do
def overload
Dotenv.overload(*dotenv_files.reverse)
end
end
Dotenv::Railtie.overload
end
2018-01-02 17:19:25 +00:00
module Sutty
2024-03-04 16:09:36 +00:00
ALLOWED_ATTRIBUTES = %w[style href src alt controls data-align data-multimedia data-multimedia-inner id name rel
target referrerpolicy class colspan rowspan role data-turbo start type reversed].freeze
ALLOWED_TAGS = %w[strong em del u mark p h1 h2 h3 h4 h5 h6 ul ol li img iframe audio video div figure blockquote
figcaption a sub sup small table thead tbody tfoot tr th td br code].freeze
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'
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
# Load application's model / class decorators
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
config.after_initialize do
ActiveStorage::DirectUploadsController.include ActiveStorage::AuthenticatedDirectUploadsController
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
def nodes
@nodes ||= ENV.fetch('SUTTY_NODES', '').split(',')
end
2018-01-02 17:19:25 +00:00
end
end