Sha256: df0d5a6228b7d961be30be18d23146e17f659708aa4208c63a7ddd65b1ed509f

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacRailsBase0App
  class Application < Rails::Application
    module Production
      common_concern do
        next unless ::Rails.env.production?

        setup('assets', 'general', 'log', 'public_file_server')
      end

      module ClassMethods
        def setup_assets
          config.assets.js_compressor = :uglifier
          config.assets.compile = false
        end

        def setup_general
          config.active_record.dump_schema_after_migration = false
          config.cache_classes = true
          config.eager_load = false
          config.consider_all_requests_local = false
          config.action_controller.perform_caching = true
          config.read_encrypted_secrets = true
          config.action_mailer.perform_caching = false
          config.i18n.fallbacks = true
        end

        def setup_log
          config.log_level = :debug
          config.log_tags = [:request_id]
          config.active_support.deprecation = :notify
          config.log_formatter = ::Logger::Formatter.new
          return if ENV['RAILS_LOG_TO_STDOUT'].blank?

          logger = ActiveSupport::Logger.new(STDOUT)
          logger.formatter = config.log_formatter
          config.logger = ActiveSupport::TaggedLogging.new(logger)
        end

        def setup_public_file_server
          config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eac_rails_base0-0.48.0 lib/eac_rails_base0/app_base/application/production.rb
eac_rails_base0-0.47.0 lib/eac_rails_base0/app_base/application/production.rb
eac_rails_base0-0.46.0 lib/eac_rails_base0/app_base/application/production.rb
eac_rails_base0-0.45.0 lib/eac_rails_base0/app_base/application/production.rb