commands/rhoconnect/config.rb in rhoconnect-4.0.0.beta.12 vs commands/rhoconnect/config.rb in rhoconnect-4.0.0.beta.24
- old
+ new
@@ -1,23 +1,27 @@
Execute.define_task do
desc "config", "Config", :hide => true
def config(settings_file=false)
+ require 'uri'
+ require 'yaml'
if File.exist?(File.join('settings','settings.yml'))
- settings = load_settings(File.join('settings','settings.yml'))
+ settings = YAML.load_file(File.join('settings','settings.yml'))
rackup_config = "config.ru"
elsif settings_file
- settings = load_settings(settings_file)
+ settings = YAML.load_file(settings_file)
rackup_config = File.join(File.dirname(__FILE__), '..', 'utilities', 'blank_app.ru')
elsif File.exist?(File.join(ENV['HOME'], '.rhoconnect.yml'))
- settings = load_settings(File.join(ENV['HOME'], '.rhoconnect.yml'))
+ settings = YAML.load_file(File.join(ENV['HOME'], '.rhoconnect.yml'))
rackup_config = File.join(File.dirname(__FILE__), '..', 'utilities', 'blank_app.ru')
else
options = { :syncserver => "http://localhost:#{RHOCONNECT_PORT}",
:redis => REDIS_SERVER_URL, :push_server => PUSH_SERVER_URL, :api_token => API_TOKEN }
settings = { :development => options, :test => options, :production => options }
rackup_config = File.join(File.dirname(__FILE__), '..', 'utilities', 'blank_app.ru')
end
- settings = settings[Rhoconnect.environment]
+
+ environment = (ENV['RHO_ENV'] || ENV['RACK_ENV'] || :development).to_sym # FIXME:
+ settings = settings[environment]
# syncserver settings
uri = URI.parse(settings[:syncserver])
port = uri.port unless port
url = "#{uri.scheme}://#{uri.host}:#{port}"
settings[:syncserver] = url