Sha256: 7854a462d8603a1175ff6e3d2478350ae0aff27aec705ec850af78fde9f92401

Contents?: true

Size: 434 Bytes

Versions: 1

Compression:

Stored size: 434 Bytes

Contents

require 'yaml'

module Dry
  module Component
    class Config
      extend Dry::Configurable

      def self.load(root, env)
        path = root.join('config').join('application.yml')

        return {} unless File.exist?(path)

        yaml = YAML.load_file(path)

        yaml.fetch(env.to_s).each do |key, value|
          setting key.downcase.to_sym, ENV.fetch(key, value)
        end

        config
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-component-0.0.1 lib/dry/component/config.rb