Ground work to remove found object logic from user model's setup method
[arvados.git] / services / api / app / controllers / static_controller.rb
index f64e9a41fadabb3b94047f40a6238b6b50861c5b..fda088095e9f5e075f4fd52eaeea711e025280e7 100644 (file)
@@ -1,10 +1,18 @@
 class StaticController < ApplicationController
+  respond_to :json, :html
 
   skip_before_filter :find_object_by_uuid
+  skip_before_filter :render_404_if_no_object
   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