Module: Envkey::Fetch

Defined in:
lib/envkey/fetch.rb

Class Method Summary collapse

Class Method Details

.fetch_envObject



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

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

.is_devObject



14
15
16
17
18
19
# File 'lib/envkey/fetch.rb', line 14

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?)
end

.should_cacheObject



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

def self.should_cache
  is_dev || ENV["ENVKEY_SHOULD_CACHE"]
end