Sha256: e0bbbb7d8e05d560199a4954c8576f084da924f4d768a48f76150c134ba6ef90
Contents?: true
Size: 871 Bytes
Versions: 3
Compression:
Stored size: 871 Bytes
Contents
module Envvy class Railtie < Rails::Railtie attr_accessor :env config.before_initialize do self.get("config") do |config| config.each do |k, v| ENV[k.to_s.upcase] = v end end end config.before_configuration do env_vars = File.join(Rails.root, "config", "env_vars.yml") set_env env_vars if Rails.env.development? require 'filewatch/watch' conf_watcher = FileWatch::Watch.new conf_watcher.watch(env_vars) Thread.new do conf_watcher.subscribe(1,5) do |status, path| set_env path end end end end def set_env file self.env = YAML.load(File.read(file)) end def get(key, &block) if block_given? yield self.env[key] else return self.env[key] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
envvy-1.0.0 | lib/envvy/railtie.rb |
envvy-1.0.0.rc2 | lib/envvy/railtie.rb |
envvy-1.0.0.rc1 | lib/envvy/railtie.rb |