Merge branch '2640-folder-api'
[arvados.git] / services / api / config / initializers / eventbus.rb
index 2d2b7bc7af3002a3ecb214b9eff8f8a8d9ed4759..7da8ade701050822c8bc8c93c71e8b44ae77b65c 100644 (file)
@@ -1,7 +1,18 @@
 require 'eventbus'
 
 Server::Application.configure do
+  # Enables websockets if ARVADOS_WEBSOCKETS is defined with any value.  If
+  # ARVADOS_WEBSOCKETS=ws-only, server will only accept websocket connections
+  # and return an error response for all other requests.
   if ENV['ARVADOS_WEBSOCKETS']
-    config.middleware.insert_after ArvadosApiToken, RackSocket, {:handler => EventBus, :websocket_only => true }
+    config.middleware.insert_after ArvadosApiToken, RackSocket, {
+      :handler => EventBus,
+      :mount => "/websocket",
+      :websocket_only => (ENV['ARVADOS_WEBSOCKETS'] == "ws-only")
+    }
   end
+
+  # Define websocket_address configuration option, can be overridden in config files.
+  # See application.yml.example for details.
+  config.websocket_address = nil
 end