From: Ward Vandewege Date: Tue, 11 Feb 2014 22:42:44 +0000 (-0500) Subject: Handle the situation where config.workbench_address is unset more X-Git-Tag: 1.1.0~2778 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/0baacafa11d24c91e4e493809c06f7c58a3fdfc7 Handle the situation where config.workbench_address is unset more gracefully: do not try to redirect and blow up, instead send a json-encoded error message. --- diff --git a/services/api/app/controllers/static_controller.rb b/services/api/app/controllers/static_controller.rb index ba69b8464f..fda088095e 100644 --- a/services/api/app/controllers/static_controller.rb +++ b/services/api/app/controllers/static_controller.rb @@ -6,7 +6,13 @@ class StaticController < ApplicationController skip_before_filter :require_auth_scope_all, :only => [ :home, :login_failure ] def home - redirect_to Rails.configuration.workbench_address + if Rails.configuration.respond_to? :workbench_address + redirect_to Rails.configuration.workbench_address + else + render json: { + error: ('This is the API server; you probably want to be at the workbench for this installation. Unfortunately, config.workbench_address is not set so I can not redirect you there automatically') + } + end end end