Skip to content

Commit

Permalink
Copy sample config if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Aug 31, 2011
1 parent 6e034f8 commit c875283
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/initializers/config.rb
@@ -1,5 +1,12 @@
require 'fileutils'

unless Rails.env.production?
config = YAML.load_file(File.expand_path(File.join(Rails.root, '/config/config.yml')))[Rails.env]
config_file = File.expand_path(File.join(Rails.root, '/config/config.yml'))
config_file_sample = File.expand_path(File.join(Rails.root, '/config/config.yml.sample'))

FileUtils.cp(config_file_sample, config_file) unless File.exists?(config_file)

config = YAML.load_file(config_file)[Rails.env]

config.each do |key, value|
ENV[key] = value
Expand Down

0 comments on commit c875283

Please sign in to comment.