made single process mode configuration more consistent

* SINGLE_PROCESS_MODE environment variable takes precedence over
  application.yml setting
* SINGLE_PROCESS environment variable takes precedence over
  SINGLE_PROCESS_MODE environment variable to be backward compatible
This commit is contained in:
Jonne Hass 2011-09-11 13:54:14 +02:00
parent 28b6e276f8
commit a614985d83
5 changed files with 10 additions and 4 deletions

View file

@ -132,4 +132,8 @@ HELP
end
return @@pod_uri
end
def self.single_process_mode?
(ENV['SINGLE_PROCESS'] == "true" || ENV['SINGLE_PROCESS_MODE'] == "true" || self[:single_process_mode]) ? true : false
end
end

View file

@ -2,7 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-if ENV['SINGLE_PROCESS']
-if AppConfig.single_process_mode?
:javascript
var websocket_enabled = false
- else

View file

@ -6,7 +6,7 @@ if !ENV['SINGLE_PROCESS'] && AppConfig[:redis_url]
Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379)
end
if ENV['SINGLE_PROCESS'] || AppConfig.single_process_mode
if AppConfig.single_process_mode?
if Rails.env == 'production'
puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this."
end

View file

@ -35,9 +35,11 @@ if ARGV.length >= 1
require 'settingslogic'
require File.join(Rails.root, 'app', 'models', 'app_config')
setting_name = setting_name.to_sym
if AppConfig[setting_name].nil?
if (!AppConfig.respond_to?(setting_name) || AppConfig.send(setting_name).nil?) && AppConfig[setting_name].nil?
$stderr.puts "Could not find setting #{ARGV[0]} for environment #{Rails.env}."
Process.exit(1)
elsif AppConfig.respond_to?(setting_name)
print AppConfig.send(setting_name)
else
print AppConfig[setting_name]
end

View file

@ -153,7 +153,7 @@ fi
# Start Diaspora
if [ "$SINGLE_PROCESS" != "true" ]; then
if [ "$(./script/get_config.rb 'single_process_mode?')" != "true" ]; then
redis_config
redis-server config/redis.conf &>log/redis-console.log &