laserlemon/figaro — pull request #10 by subosito (2012-09-08 07:17:27+00:00)
Title: allow to fetch particular environment

With this commit we now able to:

Figaro.env # fetch default env
Figaro.env('production') # fetch production env
Figaro.env('production').to_yaml # construct yaml configuration for production box

This is important because usually we deploy our configuration to staging/production server. Allowing Figaro to fetch particular environment will be huge benefits to securely export configuration based on environment. Say you have `capistrano` task:

namespace :deploy do
task :config do
run_locally %Q(rails runner 'puts Figaro.env("#{stage}").to_yaml' > _application_.yml)
transfer :up, '_application_.yml', "#{shared_path}/application.yml", via: :scp
run_locally 'rm _application_.yml'
end
end

Now we have specific `application.yml` on each server without contains any other environment configuration.