Class: Indocker::Envs::Manager

Inherits:
Object
  • Object
show all
Includes:
SmartIoC::Iocify
Defined in:
lib/indocker/envs/manager.rb

Instance Method Summary collapse

Instance Method Details

#load_init_application_env_variables ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/indocker/envs/manager.rb', line 10

def load_init_application_env_variables
  config.load_env_file.each do |path|
    env_file = File.join(config.root, path)

    begin
       = envs_loader.parse(env_file) 
    rescue Indocker::Errors::EnvFileDoesNotExist
      logger.warn "File #{env_file} doesn't exist. Check path to environment_path"
      return
    end

    .to_hash.each do |key, value|
      if ENV.has_key?(key) && ENV[key] != value
        logger.warn "Environment file '#{path}' overwrites ENV['#{key}'] from '#{ENV[key]}' to '#{value}'!"
      end

      ENV[key] = value
    end
  end
end