diff --git a/config/environments/production.rb b/config/environments/production.rb index 69bed0eda..34e3841d0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,19 +49,6 @@ Diaspora::Application.configure do config.threadsafe! - require File.join(Rails.root, 'app/models/app_config') - - if AppConfig[:google_a_site].present? - config.gem 'rack-google-analytics', :lib => 'rack/google-analytics' - config.middleware.use Rack::GoogleAnalytics, :tracker => AppConfig[:google_a_site] - end - - if AppConfig[:piwik_url].present? - config.gem 'rack-piwik', :lib => 'rack/piwik' - config.middleware.use Rack::Piwik, :piwik_url => AppConfig[:piwik_url], :piwik_id => AppConfig[:piwik_id] - end -end - # Sacrifice readability for a 10% performance boost Haml::Template::options[:ugly] = true GC.enable_stats if GC.respond_to?(:enable_stats) diff --git a/config/initializers/load_analyitics.rb b/config/initializers/load_analyitics.rb new file mode 100644 index 000000000..d071392c5 --- /dev/null +++ b/config/initializers/load_analyitics.rb @@ -0,0 +1,18 @@ +# Copyright (c) 2012, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. +#hack to allow us to access app config, rather than putting in enviroments/production.rb + +if Rails.env == 'production' + Diaspora::Application.configure do + if AppConfig[:google_a_site].present? + config.gem 'rack-google-analytics', :lib => 'rack/google-analytics' + config.middleware.use Rack::GoogleAnalytics, :tracker => AppConfig[:google_a_site] + end + + if AppConfig[:piwik_url].present? + config.gem 'rack-piwik', :lib => 'rack/piwik' + config.middleware.use Rack::Piwik, :piwik_url => AppConfig[:piwik_url], :piwik_id => AppConfig[:piwik_id] + end + end +end