# frozen_string_literal: true require 'booru/config' Rails.application.configure do # logging stuff, log to stdout or a file depending on how we're feeling today. config.log_formatter = ::Logger::Formatter.new config.eager_load = true if ENV['RAILS_LOG_TO_STDOUT'].present? config.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) else logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger.extend(ActiveSupport::Logger.broadcast(ActiveSupport::Logger.new(Rails.root.join('log', "#{Rails.env}.log")))) # config.logger = ActiveSupport::TaggedLogging.new( # ActiveSupport::Logger.new(Rails.root.join('log', )) #) config.colorize_logging = false end # Specifies the header that your server uses for sending files. config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Enable serving of images, stylesheets, and JavaScripts from an asset server. config.action_controller.asset_host = Booru::CONFIG.settings[:cdn_url_root] # Use Redis as the cache store config.active_record.cache_versioning = false config.cache_store = :redis_store, Booru::CONFIG.settings[:redis_url], { expires_in: 5.days } config.active_record.async_query_executor = :global_thread_pool # ElasticAPM has a lot of useless debug logging # Rails.application.config.elastic_apm.alert_logger = Logger.new(nil) # Rails.application.config.elastic_apm.logger = Logger.new(nil) config.active_record.encryption.key_derivation_salt = Booru::CONFIG.secrets[:key_derivation_salt] config.active_record.encryption.primary_key = Booru::CONFIG.secrets[:primary_key] config.flipflop.dashboard_access_filter = -> { head :forbidden unless can?(:manage, Flipflop) } config.active_record.encryption.support_unencrypted_data = true end