diff --git a/app/models/room.rb b/app/models/room.rb index 197fd631..2b7a7fc4 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -141,13 +141,12 @@ class Room < ApplicationRecord # Sets a BigBlueButtonApi object for interacting with the API. def bbb - @bbb ||= BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8") - # @bbb ||= if Rails.configuration.loadbalanced_configuration - # lb_user = retrieve_loadbalanced_credentials(self.room.owner.provider) - # BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8") - # else - # BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8") - # end + @bbb ||= if Rails.configuration.loadbalanced_configuration + lb_user = retrieve_loadbalanced_credentials(owner.provider) + BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8") + else + BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8") + end end # Generates a uid for the room and BigBlueButton. @@ -174,7 +173,7 @@ class Room < ApplicationRecord # Build the URI. uri = encode_bbb_url( - Rails.configuration.loadbalancer_endpoint, + Rails.configuration.loadbalancer_endpoint + "getUser", Rails.configuration.loadbalancer_secret, name: provider ) diff --git a/config/application.rb b/config/application.rb index ae323d4d..7521eea8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,7 @@ module Greenlight # Use custom error routes. config.exceptions_app = routes - config.loadbalanced_configuration = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true") + config.loadbalanced_configuration = ENV["LOADBALANCER_ENDPOINT"].present? && ENV["LOADBALANCER_SECRET"].present? # Setup BigBlueButton configuration. if config.loadbalanced_configuration