Sha256: 2b654092a420bd2b5311c45c28d9a4603f7135056fca3643c223e0493654b116
Contents?: true
Size: 824 Bytes
Versions: 2
Compression:
Stored size: 824 Bytes
Contents
# frozen_string_literal: true require "dry/core/constants" module Hanami class Settings # The default store for {Hanami:Settings}, loading setting values from `ENV`. # # If your app loads the dotenv gem, then `ENV` will also be populated from various `.env` files when # you subclass `Hanami::App`. # # @since 2.0.0 # @api private class EnvStore Undefined = Dry::Core::Constants::Undefined attr_reader :store, :hanami_env def initialize(store: ENV, hanami_env: Hanami.env) @store = store @hanami_env = hanami_env end def fetch(name, default_value = Undefined, &block) name = name.to_s.upcase args = default_value == Undefined ? [name] : [name, default_value] store.fetch(*args, &block) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta3 | lib/hanami/settings/env_store.rb |
hanami-2.0.0.beta2 | lib/hanami/settings/env_store.rb |