4535: Add default_url_options to application controller that consults
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 14 Nov 2014 19:33:55 +0000 (14:33 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 14 Nov 2014 19:33:55 +0000 (14:33 -0500)
Rails.configuration.  Added entry with documentation to
application.yml.default.

services/api/app/controllers/application_controller.rb
services/api/config/application.default.yml

index 381c5c991ff640d20b950ae17f5c6377ec5f5dab..762bbd9c1c8bd39cf88ab551eb9221489c5a5455 100644 (file)
@@ -56,6 +56,14 @@ class ApplicationController < ActionController::Base
                 :with => :render_not_found)
   end
 
+  def default_url_options
+    if Rails.configuration.host
+      {:host => Rails.configuration.host}
+    else
+      {}
+    end
+  end
+
   def index
     @objects.uniq!(&:id) if @select.nil? or @select.include? "id"
     if params[:eager] and params[:eager] != '0' and params[:eager] != 0 and params[:eager] != ''
index be1f157eb048923ad533e3f54c4ad03841c0417d..d11007c7d33bce267ac990ce9a8405856be5bdd9 100644 (file)
@@ -50,6 +50,11 @@ test:
 common:
   uuid_prefix: <%= Digest::MD5.hexdigest(`hostname`).to_i(16).to_s(36)[0..4] %>
 
+  # If set, this is the hostname that will be used for root_url and advertised
+  # in the discovery document.  By default, uses the default Rails logic for
+  # deciding on a hostname.
+  host: ~
+
   # If this is not false, HTML requests at the API server's root URL
   # are redirected to this location, and it is provided in the text of
   # user activation notification email messages to remind them where