Sha256: ffb9add445dde47e5df1fc253cd58125a3c9afd67d99383e612cd4aadcc91fa7

Contents?: true

Size: 420 Bytes

Versions: 1

Compression:

Stored size: 420 Bytes

Contents

require 'envkey/platform'

module Envkey::Fetch

  def self.fetch_env key
    fetch_env_path = Envkey::Platform.fetch_env_path
    `#{fetch_env_path} #{key}#{is_dev ? ' --cache' : ''}`
  end

  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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
envkey-1.0.1 lib/envkey/fetch.rb