Sha256: a524c5bb343828e6261ff8b1e8d0c376023384a76e004dd4cabefead1893d4ff
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
# frozen_string_literal: true module Anyway # Adds ability to generate anonymous (class-less) config dynamicly # (like Rails.application.config_for but using more data sources). module DynamicConfig module ClassMethods # Load config as Hash by any name # # Example: # # my_config = Anyway::Config.for(:my_app) # # will load data from config/my_app.yml, secrets.my_app, ENV["MY_APP_*"] # def for(name, **options) config = allocate options[:env_prefix] ||= name.to_s.upcase options[:config_path] ||= config.resolve_config_path(name, options[:env_prefix]) config.load_from_sources(name: name, **options) end end def self.included(base) base.extend ClassMethods end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
anyway_config-2.0.0.pre2 | lib/anyway/dynamic_config.rb |
anyway_config-2.0.0.pre | lib/anyway/dynamic_config.rb |