Module: Rails::Service::AppConfig
- Defined in:
- lib/rails/service/app_config.rb
Class Method Summary collapse
Class Method Details
.new(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rails/service/app_config.rb', line 11 def new( = {}) path = .fetch(:path) logger = .fetch(:logger) env = .fetch(:env) if File.exist?(path) file = File.read(path) logger.info("loading app config file: #{path}") DeepStruct.new(YAML.load(ERB.new(file).result)[env.to_s]) else logger.warn("app config file not found: #{path}") nil end end |