Permalink
Browse files

Remove environment variables from initialization.

  • Loading branch information...
arthuraa committed Apr 6, 2011
1 parent 2ffd59f commit 043c429c72c68dc5fd1be3c560cb313239fdf96b
Showing with 7 additions and 22 deletions.
  1. +6 −3 config/initializers/00_config.rb
  2. +1 −1 config/initializers/mongo.rb
  3. +0 −10 script/set_heroku_env_from_yml
  4. +0 −8 script/yml_to_env
@@ -2,16 +2,19 @@
require "#{Rails.root}/lib/tracking/mixpanel"
-options = YAML.load(ENV["SHAPADO_YML"])
+config_file = Rails.root + "config/shapado.yml"
+
+options = YAML.load_file(config_file)
if !options[Rails.env]
- raise "'#{Rails.env}' was not found in SHAPADO_YML"
+ raise "'#{Rails.env}' was not found in #{config_file}"
end
AppConfig = OpenStruct.new(options[Rails.env])
# check config
begin
- known_options = YAML.load(ENV["SHAPADO_YML_SAMPLE"])[Rails.env]
+ sample_file = Rails.root + "config/shapado.yml.sample"
+ known_options = YAML.load_file(sample_file)[Rails.env]
if known_options
known_options.each do |k, v|
if AppConfig.send(k).nil?
@@ -1,6 +1,6 @@
require 'mm-paginate'
-MongoMapper.setup(YAML.load(ENV["DATABASE_YML"]),
+MongoMapper.setup(YAML.load_file(Rails.root.join("config", "database.yml")),
Rails.env, { :logger => Rails.logger, :passenger => false })
MongoMapperExt.init(:enable_magic => false)
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-# Export configuration files to environment variables in our Heroku
-# app.
-
-heroku config:add SHAPADO_YML="$(< config/shapado.yml)" \
- SHAPADO_YML_SAMPLE="$(< config/shapado.yml.sample)" \
- DEFAULT_REPUTATION_YML="$(< config/default_reputation.yml)" \
- DATABASE_YML="$(< config/database.yml)"
-
View
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-# Export configuration files to environment variables.
-
-export SHAPADO_YML=$(< config/shapado.yml)
-export SHAPADO_YML_SAMPLE=$(< config/shapado.yml.sample)
-export DEFAULT_REPUTATION_YML=$(< config/default_reputation.yml)
-export DATABASE_YML=$(< config/database.yml)

0 comments on commit 043c429

Please sign in to comment.