Module: Envkey::Fetch

Defined in:
lib/envkey/fetch.rb

Class Method Summary collapse

Class Method Details

.fetch_env(key) ⇒ Object



5
6
7
8
# File 'lib/envkey/fetch.rb', line 5

def self.fetch_env key
  fetch_env_path = Envkey::Platform.fetch_env_path
  `#{fetch_env_path} #{key}#{is_dev ? ' --cache' : ''} --client-name envkey-ruby --client-version #{Envkey::VERSION} 2>&1`
end

.is_devObject



10
11
12
13
14
15
# File 'lib/envkey/fetch.rb', line 10

def self.is_dev
  dev_vals = %w(development test)
  dev_vals.include?(ENV["RAILS_ENV"]) ||
    dev_vals.include?(ENV["RACK_ENV"]) ||
    (ENV["RAILS_ENV"].nil? && ENV["RACK_ENV"].nil? && File.exist?(".env"))
end