added redis settings to config, changed config keys to uppercase

This commit is contained in:
Thomas Buchöster
2011-07-07 10:31:38 +02:00
committed by Thomas Buchöster
parent 3a033eeec2
commit 2f8e936372
7 changed files with 14 additions and 11 deletions
+3 -1
View File
@@ -3,4 +3,6 @@ lastfm_api_key: ""
facebook: facebook:
app_id: "" app_id: ""
secret: "" secret: ""
request_timeout: "" redis:
development: ""
production: ""
+2 -2
View File
@@ -3,10 +3,10 @@ if Rails.env !=~ /production/
APP_CONFIG.each do |key, value| APP_CONFIG.each do |key, value|
if value.is_a?(Hash) if value.is_a?(Hash)
value.each do |k,v| value.each do |k,v|
ENV["#{key}_#{k}"] = v ENV["#{key}_#{k}".upcase] = v
end end
else else
ENV[key] = value ENV[(key.upcase)] = value
end end
end end
end end
+2 -2
View File
@@ -185,10 +185,10 @@ Devise.setup do |config|
# Facebook-Setting for Heroku # Facebook-Setting for Heroku
if Rails.env =~ /production/ if Rails.env =~ /production/
config.omniauth :facebook, ENV['facebook_app_id'], ENV['facebook_secret'] config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET']
{:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}} {:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
else else
config.omniauth :facebook, ENV['facebook_app_id'], ENV['facebook_secret'] config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET']
end end
config.omniauth :open_id, OpenID::Store::Filesystem.new('/tmp') config.omniauth :open_id, OpenID::Store::Filesystem.new('/tmp')
+1 -1
View File
@@ -1,3 +1,3 @@
ActionDispatch::Callbacks.to_prepare do ActionDispatch::Callbacks.to_prepare do
LastFM::Request::api_key = ENV['lastfm_api_key'] LastFM::Request::api_key = ENV['LASTFM_API_KEY']
end end
+4 -3
View File
@@ -1,8 +1,9 @@
$redis = Redis.new(:host => 'localhost', :port => 6379) uri = Rails.env ==~ /production/ ? URI.parse(ENV['REDIS_PRODUCTION']) : URI.parse(ENV['REDIS_DEVELOPMENT'])
$redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
begin begin
$redis.ping $redis.ping
puts "=> Established connection to redis server" puts "=> Established connection to redis server on '#{uri.host}' (port #{uri.port})!"
rescue rescue
puts "=> CAUTION: cound not establish connection to redis server! Check settings in initializer!" puts "=> CAUTION: cound not establish connection to redis server on '#{uri.host}' (port #{uri.port})! Check settings in initializer!"
end end
+1 -1
View File
@@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid! # If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random, # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks. # no regular words or you'll be exposed to dictionary attacks.
Nineminutes::Application.config.secret_token = ENV['secret_token'] Nineminutes::Application.config.secret_token = ENV['SECRET_TOKEN']
+1 -1
View File
@@ -67,7 +67,7 @@ module LastFM
private private
def self.create_and_queue_request method, node, block, request_params def self.create_and_queue_request method, node, block, request_params
request = Typhoeus::Request.new(base_uri, :params => request_params) # :timeout => ENV["request_timeout"], request = Typhoeus::Request.new(base_uri, :params => request_params)
handle_response request, method, node, block handle_response request, method, node, block
puts "=> lastfm: '#{current_class_name}.#{method}' request is queued" if @@hydra.queue request puts "=> lastfm: '#{current_class_name}.#{method}' request is queued" if @@hydra.queue request