incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trot...@apache.org
Subject svn commit: r454442 - /incubator/heraldry/idp/pip/trunk/config/environment.rb
Date Mon, 09 Oct 2006 17:54:43 GMT
Author: trotter
Date: Mon Oct  9 10:54:43 2006
New Revision: 454442

URL: http://svn.apache.org/viewvc?view=rev&rev=454442
Log:
* Do not require api_keys.yml file to exist or be populated.

Modified:
    incubator/heraldry/idp/pip/trunk/config/environment.rb

Modified: incubator/heraldry/idp/pip/trunk/config/environment.rb
URL: http://svn.apache.org/viewvc/incubator/heraldry/idp/pip/trunk/config/environment.rb?view=diff&rev=454442&r1=454441&r2=454442
==============================================================================
--- incubator/heraldry/idp/pip/trunk/config/environment.rb (original)
+++ incubator/heraldry/idp/pip/trunk/config/environment.rb Mon Oct  9 10:54:43 2006
@@ -52,7 +52,18 @@
 APP_CONFIG[:app_host] = 'test.host' if ENV['RAILS_ENV'] == 'test'
 APP_CONFIG[:restricted_names] = APP_CONFIG[:restricted_names] ? APP_CONFIG[:restricted_names].split(/\s*,\s*/)
: []
 
-API_KEYS = YAML::load(ERB.new(IO.read("#{RAILS_ROOT}/config/api_keys.yml")).result).symbolize_keys
+api_keys_file = "#{RAILS_ROOT}/config/api_keys.yml"
+if File.exists?(api_keys_file)
+  api_keys = YAML::load(ERB.new(IO.read(api_keys_file)).result)
+
+  if api_keys
+    API_KEYS = api_keys.symbolize_keys
+  else
+    STDERR.puts "No keys in api_keys.yml."
+  end
+else
+  STDERR.puts "No api_keys.yml file." # Don't want this to be an application killing error.
+end
 
 # The XMLSimple parser is breaking.  Turning off until it can be fixed.
 # ActionController::Base.param_parsers[Mime::XML] = nil



Mime
View raw message