Sha256: 4c3b4782f364e86018f9d8fe36eaf3cf4f138e7c6aff1df80ab33b4ac70314af
Contents?: true
Size: 805 Bytes
Versions: 1
Compression:
Stored size: 805 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(new_empty_config, name:, **options) end end def self.included(base) base.extend ClassMethods end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
anyway_config-2.1.0 | lib/anyway/dynamic_config.rb |