Sha256: 712d604a44c2a1c14dc879dbb3f388ba112f1a907b16ac7b6b45cecf53d0effc
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require "envious/railtie" require "pp" module Envious extend self def vars_for_heroku() env_vars = default_vars.merge(environment_vars) env_vars = env_vars.map { |k, v| "#{k}=#{v}"}.join(' ') end def load_env() add_to_environment(default_vars.merge(environment_vars)) end def file @file ||= Rails.root.join('config/environment_vars.yml') end def yaml @yaml ||= File.exist?(file) ? YAML.load(File.read(file)) : {} end def environment Rails.env.to_s end def default_vars() yaml.reject { |_, v| Hash === v } end def environment_vars yaml.fetch(environment, {}) end def add_to_environment(hash) hash.each { |key, value| ENV[key.to_s] = value.to_s unless ENV.key?(key.to_s) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
envious-0.2.0 | lib/envious.rb |