Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorMrZYX <pr0fkill@gmail.com>2011-05-17 17:56:56 +0400
committerMrZYX <pr0fkill@gmail.com>2011-05-17 18:00:47 +0400
commit00c6631f11dd107832dcc1e7daaec05e20ec5878 (patch)
treee56b7ad31aabe1807e287ff7d49c2b5ae986574b /script
parent4875d6557dd1fbd49b653a027086479e7c7a5b1e (diff)
replaced SOCKET_PORT in config/server.sh with the setting from config/app_config.yml; respect single_process_mode setting in app_config.yml in script/server
Diffstat (limited to 'script')
-rwxr-xr-xscript/get_config.rb42
-rwxr-xr-xscript/server7
2 files changed, 47 insertions, 2 deletions
diff --git a/script/get_config.rb b/script/get_config.rb
new file mode 100755
index 000000000..1f0067965
--- /dev/null
+++ b/script/get_config.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+# Copyright (c) 2011, Diaspora Inc. This file is
+# licensed under the Affero General Public License version 3 or later. See
+# the COPYRIGHT file.
+
+require 'rubygems'
+require 'yaml'
+
+require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/hash/keys'
+
+class Rails
+ def self.root
+ File.join(File.dirname(__FILE__), "..")
+ end
+
+ def self.env
+ env = 'development'
+ env = ENV['RAILS_ENV'] if ENV.has_key?('RAILS_ENV')
+ env = ARGV[1] if ARGV.length == 2
+ env.downcase
+ end
+end
+
+require File.join(Rails.root, 'lib', 'app_config')
+
+
+if ARGV.length >= 1
+ key = ARGV[0].to_sym
+ AppConfig.configure_for_environment(Rails.env)
+ if AppConfig.has_key?(key)
+ print AppConfig[key]
+ else
+ puts "Invalid option #{ARGV[0]}"
+ exit 2
+ end
+else
+ puts "Usage: ./script/get_config.rb option [environment]"
+ puts ""
+ puts "envrionment defaults to development"
+ exit 1
+end
diff --git a/script/server b/script/server
index d94da6d15..8b6270b75 100755
--- a/script/server
+++ b/script/server
@@ -10,6 +10,7 @@ OS=`uname -s`
[ -e config/server.sh ] && source config/server.sh
+export SOCKET_PORT=$(./script/get_config.rb socket_port $RAILS_ENV)
function init_public
# Create all dynamically generated files in public/ folder
@@ -169,6 +170,8 @@ fi
mkdir -p -v log/thin/
bundle exec ruby ./script/websocket_server.rb&
-redis-server config/redis.conf &>log/redis-console.log &
-QUEUE=* bundle exec rake resque:work&
+if [ "$(./script/get_config.rb single_process_mode $RAILS_ENV)" = "false" ]; then
+ redis-server config/redis.conf &>log/redis-console.log &
+ QUEUE=* bundle exec rake resque:work&
+fi
bundle exec thin start $args