Class: Configurate::Provider::Env

Inherits:
Base
  • Object
show all
Defined in:
lib/configurate/provider/env.rb

Overview

This provider looks for settings in the environment. For the setting foo.bar_baz this provider will look for an environment variable FOO_BAR_BAZ, joining all components of the setting with underscores and upcasing the result. If an value contains any commas (,) it's split at them and returned as array.

Instance Method Summary collapse

Methods inherited from Base

#lookup

Instance Method Details

#lookup_path(setting_path, *_args) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/configurate/provider/env.rb', line 9

def lookup_path(setting_path, *_args)
  value = ENV[setting_path.join("_").upcase]
  unless value.nil?
    value = value.dup
    value = value.split(",") if value.include?(",")
  end
  value
end