Allow hardcoding of protocol and port components of root_url alongside host
authorJoshua C. Randall <jcrandall@alum.mit.edu>
Fri, 13 Jul 2018 15:40:02 +0000 (15:40 +0000)
committerJoshua C. Randall <jcrandall@alum.mit.edu>
Fri, 13 Jul 2018 15:40:02 +0000 (15:40 +0000)
Arvados-DCO-1.1-Signed-off-by: Joshua C. Randall <jcrandall@alum.mit.edu>

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

index ba7c07d27266f26ef3bcdbcfc01940d406cec9b1..169f4d40f78ea635153a37f4186ea9decb708d8f 100644 (file)
@@ -81,11 +81,17 @@ class ApplicationController < ActionController::Base
   end
 
   def default_url_options
+    options = {}
     if Rails.configuration.host
-      {:host => Rails.configuration.host}
-    else
-      {}
+      options[:host] = Rails.configuration.host
+    end
+    if Rails.configuration.port
+      options[:port] = Rails.configuration.port
+    end
+    if Rails.configuration.protocol
+      options[:protocol] = Rails.configuration.protocol
     end
+    options
   end
 
   def index
index f976a83ca96bf4cffb562cd74f3ccaf27590198f..5a1c229513f71984b17448950e96182c8fa5b283 100644 (file)
@@ -93,10 +93,12 @@ common:
   ### Overriding default advertised hostnames/URLs
   ###
 
-  # If not false, this is the hostname that will be used for root_url and
-  # advertised in the discovery document.  By default, use the default Rails
-  # logic for deciding on a hostname.
+  # If not false, this is the hostname, port, and protocol that will be used
+  # for root_url and advertised in the discovery document.  By default, use
+  # the default Rails logic for deciding on a hostname.
   host: false
+  port: false
+  protocol: false
 
   # Base part of SSH git clone url given with repository resources. If
   # true, the default "git@git.(uuid_prefix).arvadosapi.com:" is