Sha256: 41fd1aff50fd7cc5a85120716e984af1ef6f74ab5ce0a91b9ffd10c926d5bb14

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

require 'socket'

module Chamber
module Integrations
module Sinatra
  def self.registered(app)
    app.configure do |inner_app|
      env  = inner_app.environment || ENV.fetch('RACK_ENV', nil)
      root = inner_app.root

      if defined?(Padrino)
        env  = Padrino.env  if Padrino.respond_to?(:env)
        root = Padrino.root if Padrino.respond_to?(:root)
      end

      Chamber.load(
        basepath:   root,
        namespaces: {
          environment: -> { env },
          hostname:    -> { Socket.gethostname },
        },
      )
    end
  end
end
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chamber-3.1.1 lib/chamber/integrations/sinatra.rb
chamber-3.1.0 lib/chamber/integrations/sinatra.rb
chamber-3.0.1 lib/chamber/integrations/sinatra.rb
chamber-3.0.0 lib/chamber/integrations/sinatra.rb