Permalink
Browse files

read optional config file

  • Loading branch information...
1 parent 1560acb commit 8783eaa69272e17a6279dfa9d25217036a56bd0c @technoweenie committed Feb 19, 2011
Showing with 9 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +8 −4 allofthestars.rb
View
@@ -1 +1,2 @@
*.beam
+db/config.json
View
@@ -5,16 +5,20 @@ module AllOfTheStars
class << self
attr_accessor :env, :riak_client
end
- self.env = (ENV['RACK_ENV'] || ENV['STARS_ENV'] || :dev).to_sym
end
-Bundler.require(:default, AllOfTheStars.env)
+Bundler.require(:default)
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
options = {:http_backend => :Excon}
-if AllOfTheStars.env == :production
- options[:host] = 'riak1.allofthestars.com'
+config = File.expand_path('../db/config.json', __FILE__)
+if File.exist?(config)
+ data = ActiveSupport::JSON.decode(IO.read(config))
+ data.each do |key, value|
+ options[key.to_sym] = value
+ end
end
+
AllOfTheStars.riak_client = Riak::Client.new(options)
require 'allofthestars/cluster'
require 'allofthestars/star'

0 comments on commit 8783eaa

Please sign in to comment.