it's enviroNment

This commit is contained in:
Jonne Haß 2012-09-15 18:52:12 +02:00
parent 9e264b5258
commit 6c1a1ec6d2
14 changed files with 19 additions and 19 deletions

View file

@ -13,7 +13,7 @@ class PublicsController < ApplicationController
# I am commenting this line out for the time being to debug some apparent # I am commenting this line out for the time being to debug some apparent
# issues on Heroku. # issues on Heroku.
# #
# newrelic_ignore if EnviromentConfiguration.using_new_relic? # newrelic_ignore if EnvironmentConfiguration.using_new_relic?
skip_before_filter :set_header_data skip_before_filter :set_header_data
skip_before_filter :set_grammatical_gender skip_before_filter :set_grammatical_gender

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file. # the COPYRIGHT file.
require 'uri' require 'uri'
require Rails.root.join('lib', 'enviroment_configuration') require Rails.root.join('lib', 'environment_configuration')
class AppConfig < Settingslogic class AppConfig < Settingslogic
def self.source_file_name def self.source_file_name
@ -12,7 +12,7 @@ class AppConfig < Settingslogic
return ENV['application_yml'] return ENV['application_yml']
end end
config_file = Rails.root.join("config", "application.yml") config_file = Rails.root.join("config", "application.yml")
if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnviromentConfiguration.heroku?) if !File.exists?(config_file) && (Rails.env == 'test' || Rails.env.include?("integration") || EnvironmentConfiguration.heroku?)
config_file = Rails.root.join("config", "application.yml.example") config_file = Rails.root.join("config", "application.yml.example")
end end
config_file config_file
@ -21,7 +21,7 @@ class AppConfig < Settingslogic
namespace Rails.env namespace Rails.env
def self.load! def self.load!
unless EnviromentConfiguration.heroku? unless EnvironmentConfiguration.heroku?
if no_config_file? && !have_old_config_file? if no_config_file? && !have_old_config_file?
$stderr.puts <<-HELP $stderr.puts <<-HELP
******** You haven't set up your Diaspora settings file. ********** ******** You haven't set up your Diaspora settings file. **********
@ -57,7 +57,7 @@ Please do the following:
Process.exit(1) Process.exit(1)
end end
if !EnviromentConfiguration.heroku? && no_cert_file_in_prod? if !EnvironmentConfiguration.heroku? && no_cert_file_in_prod?
$stderr.puts <<-HELP $stderr.puts <<-HELP
******** Diaspora does not know where your SSL-CA-Certificates file is. ********** ******** Diaspora does not know where your SSL-CA-Certificates file is. **********
Please add the root certificate bundle (this is operating system specific) to application.yml. Defaults: Please add the root certificate bundle (this is operating system specific) to application.yml. Defaults:

View file

@ -1 +1 @@
EnviromentConfiguration.ensure_secret_token! EnvironmentConfiguration.ensure_secret_token!

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
if EnviromentConfiguration.enforce_ssl? if EnvironmentConfiguration.enforce_ssl?
Rails.application.config.middleware.insert_before 0, Rack::SSL Rails.application.config.middleware.insert_before 0, Rack::SSL
puts "Rack::SSL is enabled" puts "Rack::SSL is enabled"
end end

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file. # the COPYRIGHT file.
options = {:timeout => 25} options = {:timeout => 25}
options[:ssl] = {:ca_file => EnviromentConfiguration.ca_cert_file_location} options[:ssl] = {:ca_file => EnvironmentConfiguration.ca_cert_file_location}
Faraday.default_connection = Faraday::Connection.new(options) do |b| Faraday.default_connection = Faraday::Connection.new(options) do |b|
b.use FaradayMiddleware::FollowRedirects b.use FaradayMiddleware::FollowRedirects
b.adapter Faraday.default_adapter b.adapter Faraday.default_adapter

View file

@ -5,7 +5,7 @@ if AppConfig[:featured_users].present? && AppConfig[:community_spotlight].blank?
puts "DEPRICATION WARNING (10/21/11): Please change `featured_users` in your application.yml to `community_spotlight`. Thanks!" puts "DEPRICATION WARNING (10/21/11): Please change `featured_users` in your application.yml to `community_spotlight`. Thanks!"
end end
unless EnviromentConfiguration.prevent_fetching_community_spotlight? unless EnvironmentConfiguration.prevent_fetching_community_spotlight?
print "Fetching community spotlight users from remote servers" print "Fetching community spotlight users from remote servers"
AppConfig[:community_spotlight].each do |x| AppConfig[:community_spotlight].each do |x|
Webfinger.new(x).fetch Webfinger.new(x).fetch

View file

@ -1,7 +1,7 @@
# Copyright (c) 2012, Diaspora Inc. This file is # Copyright (c) 2012, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
#hack to allow us to access app config, rather than putting in enviroments/production.rb #hack to allow us to access app config, rather than putting in environments/production.rb
if Rails.env == 'production' if Rails.env == 'production'
Diaspora::Application.configure do Diaspora::Application.configure do

View file

@ -2,6 +2,6 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
if EnviromentConfiguration.using_new_relic? if EnvironmentConfiguration.using_new_relic?
require 'newrelic_rpm' require 'newrelic_rpm'
end end

View file

@ -11,6 +11,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do
end end
if SERVICES['facebook'] && SERVICES['facebook']['app_id'] && SERVICES['facebook']['app_secret'] if SERVICES['facebook'] && SERVICES['facebook']['app_id'] && SERVICES['facebook']['app_secret']
provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], { :display => "popup", :scope => "publish_actions,publish_stream,offline_access", provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], { :display => "popup", :scope => "publish_actions,publish_stream,offline_access",
:client_options => {:ssl => {:ca_file => EnviromentConfiguration.ca_cert_file_location}}} :client_options => {:ssl => {:ca_file => EnvironmentConfiguration.ca_cert_file_location}}}
end end
end end

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file. # the COPYRIGHT file.
if EnviromentConfiguration.cache_git_version? if EnvironmentConfiguration.cache_git_version?
git_cmd = `git log -1 --pretty="format:%H %ci"` git_cmd = `git log -1 --pretty="format:%H %ci"`
if git_cmd =~ /^([\d\w]+?)\s(.+)$/ if git_cmd =~ /^([\d\w]+?)\s(.+)$/
AppConfig[:git_revision] = $1 AppConfig[:git_revision] = $1

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
module EnviromentConfiguration module EnvironmentConfiguration
def self.heroku? def self.heroku?
ENV['HEROKU'] ENV['HEROKU']

View file

@ -1,4 +1,4 @@
#we dont have the enviroment, and it is not carring over from the migration #we dont have the environment, and it is not carring over from the migration
unless defined?(Person) unless defined?(Person)
class Person < ActiveRecord::Base class Person < ActiveRecord::Base
belongs_to :owner, :class_name => 'User' belongs_to :owner, :class_name => 'User'

View file

@ -2,7 +2,7 @@
#licensed under the Affero General Public License version 3 or later. See #licensed under the Affero General Public License version 3 or later. See
#the COPYRIGHT file. #the COPYRIGHT file.
require Rails.root.join('lib', 'enviroment_configuration') require Rails.root.join('lib', 'environment_configuration')
namespace :heroku do namespace :heroku do
HEROKU_CONFIG_ADD_COMMAND = "heroku config:add" HEROKU_CONFIG_ADD_COMMAND = "heroku config:add"

View file

@ -7,7 +7,7 @@ class DeferredGarbageCollection
@@last_gc_run = Time.now @@last_gc_run = Time.now
def self.start def self.start
return if unsupported_enviroment return if unsupported_environment
GC.disable if DEFERRED_GC_THRESHOLD > 0 GC.disable if DEFERRED_GC_THRESHOLD > 0
end end
@ -18,7 +18,7 @@ class DeferredGarbageCollection
end end
def self.reconsider def self.reconsider
return if unsupported_enviroment return if unsupported_environment
if (percent_used = self.memory_threshold) if (percent_used = self.memory_threshold)
running_out_of_memory = percent_used > 90 running_out_of_memory = percent_used > 90
@ -34,7 +34,7 @@ class DeferredGarbageCollection
end end
end end
def self.unsupported_enviroment def self.unsupported_environment
ENV['TRAVIS'] # TODO: enable for ruby 1.9.3 or more RAM ENV['TRAVIS'] # TODO: enable for ruby 1.9.3 or more RAM
end end