Sha256: 379dd1f75cde27375dd1dfce0e4e5202d4b4005c0034b6d20cd4e4f4bef8274d

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module Jets
  module Shim
    extend Memoist

    def handler(event, context, route = nil)
      Handler.new(event, context, route).handle
    end

    def to_rack_env(event, context)
      Handler.new(event, context).to_rack_env
    end

    def boot
      # Don't boot Jets in maintenance mode. Makes cold start much faster.
      return if Maintenance.enabled?

      paths = %w[
        config/jets/shim.rb
      ]
      paths.map! do |path|
        path.starts_with?(".") ? path : "./#{path}"
      end
      found = paths.find { |p| File.exist?(p) }
      if found
        require found # calls Jets.shim.configure
      else
        config.rack_app # all settings are inferred
      end

      # Boot Jets to add additional features
      Jets.boot
    end

    def configure
      yield config
    end

    def config
      Config.instance
    end

    extend self
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/shim.rb
jets-6.0.4 lib/jets/shim.rb
jets-6.0.3 lib/jets/shim.rb
jets-6.0.2 lib/jets/shim.rb