Sha256: bf7b0f31dfecee392b73b6b15b114fab85290a47cebb67cc689a1a94fda19fca

Contents?: true

Size: 735 Bytes

Versions: 6

Compression:

Stored size: 735 Bytes

Contents

require "dry/web/container"

module Dry
  module Web
    class Umbrella < Dry::Web::Container
      setting :settings_loader
      setting :settings

      def self.configure(env = config.env, &block)
        super() do |config|
          yield(config) if block

          if config.settings_loader && config.settings.nil?
            config.settings = load_settings(config.settings_loader, root, env)
          end
        end

        self
      end

      def self.load_settings(loader, root, env)
        begin
          loader.load(root, env)
        rescue => e
          puts "Could not load your settings: #{e}"
          puts
          raise e
        end
      end
      private_class_method :load_settings
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-web-0.6.0 lib/dry/web/umbrella.rb
dry-web-0.5.0 lib/dry/web/umbrella.rb
dry-web-0.4.1 lib/dry/web/umbrella.rb
dry-web-0.4.0 lib/dry/web/umbrella.rb
dry-web-0.3.1 lib/dry/web/umbrella.rb
dry-web-0.3.0 lib/dry/web/umbrella.rb