From 4bd9b81f65989cf2a5e9345aa342ed88f31a31b5 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Tue, 22 Nov 2011 20:47:45 +0200 Subject: [PATCH] Change default_url_options settings. Stub brutal hack. Refs #2261 --- app/models/platform.rb | 3 ++- config/application.rb | 1 - config/environments/development.rb | 3 +-- config/environments/production.rb | 1 + config/environments/test.rb | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/platform.rb b/app/models/platform.rb index 48e237a77..fccd1f28a 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -133,7 +133,8 @@ class Platform < ActiveRecord::Base FileUtils.rm_rf "#{ Rails.root.join('tmp', 'umount', self.unixname) }" if File.exist? "#{ Rails.root.join('tmp', 'umount', unixname) }" FileUtils.mkdir_p "#{ Rails.root.join('tmp', 'mount', unixname) }" Arch.all.each do |arch| - url = "http://#{EventLog.current_controller.request.host_with_port}/downloads/#{unixname}/repository/" # TODO REDO ? + host = EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] + url = "http://#{host}/downloads/#{unixname}/repository/" str = "country=Russian Federation,city=Moscow,latitude=52.18,longitude=48.88,bw=1GB,version=2011,arch=#{arch.name},type=distrib,url=#{url}\n" File.open(Rails.root.join('tmp', 'mount', unixname, "#{unixname}.#{arch.name}.list"), 'w') {|f| f.write(str) } end diff --git a/config/application.rb b/config/application.rb index 1458d9b8c..090e206c5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -41,6 +41,5 @@ module Rosa # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] - config.action_mailer.default_url_options = { :host => 'npp-build.rosalab.ru' } end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 96203c79f..ea2a0ad58 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,14 +16,13 @@ Rosa::Application.configure do # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false + config.action_mailer.default_url_options = { :host => 'localhost:3000' } # Print deprecation notices to the Rails logger config.active_support.deprecation = :log # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - - config.action_mailer.default_url_options = { :host => 'localhost:3000' } end # Uncomment this to stub XML RPC calls diff --git a/config/environments/production.rb b/config/environments/production.rb index e837c8da1..aaa0ff1c2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -36,6 +36,7 @@ Rosa::Application.configure do # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false + config.action_mailer.default_url_options = { :host => 'npp-build.rosalab.ru' } # Enable threaded mode # config.threadsafe! diff --git a/config/environments/test.rb b/config/environments/test.rb index eae17feb4..09b97bdb2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -24,6 +24,7 @@ Rosa::Application.configure do # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + config.action_mailer.default_url_options = { :host => 'localhost:3000' } # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper,