lib/dry/component/config.rb in dry-component-0.0.1 vs lib/dry/component/config.rb in dry-component-0.1.0
- old
+ new
@@ -1,23 +1,23 @@
require 'yaml'
module Dry
module Component
class Config
- extend Dry::Configurable
+ def self.load(root, name, env)
+ path = root.join('config').join("#{name}.yml")
- 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
+ Class.new do
+ extend Dry::Configurable
- config
+ yaml.fetch(env.to_s).each do |key, value|
+ setting key.downcase.to_sym, ENV.fetch(key, value)
+ end
+ end.config
end
end
end
end