Sha256: 4b719c2b67d137acd70ac1cf43da5a9bd5967804590f94f0dfd39445fd8e3725
Contents?: true
Size: 641 Bytes
Versions: 1
Compression:
Stored size: 641 Bytes
Contents
require 'yaml' require 'erb' require 'rails/service/core_ext/deep_struct' module Rails module Service module AppConfig module_function def new(options = {}) path = options.fetch(:path) logger = options.fetch(:logger) env = options.fetch(:env) path = Rails.root.join(path) 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-service-0.1.0 | lib/rails/service/app_config.rb |