move analytics to initializer, thx MrZYX
This commit is contained in:
parent
5a0f948a85
commit
0199949f3c
2 changed files with 18 additions and 13 deletions
|
|
@ -49,19 +49,6 @@ Diaspora::Application.configure do
|
||||||
config.threadsafe!
|
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
|
# Sacrifice readability for a 10% performance boost
|
||||||
Haml::Template::options[:ugly] = true
|
Haml::Template::options[:ugly] = true
|
||||||
GC.enable_stats if GC.respond_to?(:enable_stats)
|
GC.enable_stats if GC.respond_to?(:enable_stats)
|
||||||
|
|
|
||||||
18
config/initializers/load_analyitics.rb
Normal file
18
config/initializers/load_analyitics.rb
Normal file
|
|
@ -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
|
||||||
Loading…
Reference in a new issue