Module: EnvJson
- Defined in:
- lib/env_json.rb,
lib/env_json/railtie.rb,
lib/env_json/version.rb
Overview
Module containing utilities for loading a JSON file into environments variables. see #load_env_from_source_with_overrides
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
EnvJson version
"0.3.2"
Class Method Summary collapse
-
.env ⇒ Hash
return the consolidated env built by #load_env_from_source_with_overrides.
-
.load_env_from_source_with_overrides(json, environment_name = nil) ⇒ Hash
Load environments variables from a source into ENV.
Class Method Details
.env ⇒ Hash
return the consolidated env built by #load_env_from_source_with_overrides
22 23 24 |
# File 'lib/env_json.rb', line 22 def env @env or fail 'call load_env_from_source_with_overrides first' end |
.load_env_from_source_with_overrides(json, environment_name = nil) ⇒ Hash
Load environments variables from a source into ENV
13 14 15 16 17 18 |
# File 'lib/env_json.rb', line 13 def load_env_from_source_with_overrides(json, environment_name=nil) json = JSON.load(json) @env = generate_configuration(json, environment_name).tap do |configuration| apply_env(configuration) end end |