Sha256: c256c4921a595a206eed53d6267aadf42f63cd84ea59826c8d2b6a0acd17ec62

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

require "forwardable"
require "econfig/version"
require "econfig/memory"
require "econfig/yaml"
require "econfig/env"
require "econfig/configuration"
require "econfig/shortcut"
require "econfig/backend_collection"

module Econfig
  class NotFound < StandardError; end
  class UninitializedError < StandardError; end

  class << self
    extend Forwardable

    attr_accessor :root, :env, :instance

    def_delegators :instance, :backends, :default_write_backend, :default_write_backend=

    def init
      backends.each do |backend|
        backend.init if backend.respond_to?(:init)
      end
    end
  end
end

Econfig.instance = Econfig::Configuration.new

Econfig.default_write_backend = :memory
Econfig.backends.use :memory, Econfig::Memory.new
Econfig.backends.use :env, Econfig::ENV.new
Econfig.backends.use :secrets, Econfig::YAML.new("config/secrets.yml")
Econfig.backends.use :yaml, Econfig::YAML.new("config/app.yml")

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
econfig-1.0.2 lib/econfig.rb