Module: EnvLoader

Defined in:
lib/env_loader.rb,
lib/env_loader/version.rb,
lib/env_loader/configurator.rb

Defined Under Namespace

Classes: Configurator

Constant Summary collapse

VERSION =
'0.4.1'

Class Method Summary collapse

Class Method Details

.read(config_file = File.join('config', 'env_variables.yml')) ⇒ Object

DEPRECATED (<= 0.2.0): Legacy setup which will be replaced by the above



21
22
23
# File 'lib/env_loader.rb', line 21

def self.read(config_file = File.join('config', 'env_variables.yml'))
  config(config_file: config_file)
end

.setup_microserviceObject

A .microservices-config.yml file must be placed at the parent directory of the microservice



13
14
15
16
17
# File 'lib/env_loader.rb', line 13

def self.setup_microservice
  subtree_key = environment
  subtree_key += ".#{Rails.application.class.parent_name.underscore}" if defined?(Rails)
  config(config_file: File.join('..', '.microservices-config.yml'), config_subtree_key: subtree_key)
end

.setup_monolithObject

A .monolith-config.yml file must be placed at the root of the monolith



8
9
10
# File 'lib/env_loader.rb', line 8

def self.setup_monolith
  config(config_file: File.join('.monolith-config.yml'), config_subtree_key: environment)
end