Skip to content
Snippets Groups Projects
Unverified Commit 286cf639 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Add /api if missing from endpoint (#4062)

* Add /api if missing from endpoint

* rubo

* rspec fix

* ruba again
parent f79c975b
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ class BigBlueButtonApi
def bbb_server
# TODO: Amir - Protect the BBB secret.
# TODO: Hadi - Add additional logic here...
@bbb_server ||= BigBlueButton::BigBlueButtonApi.new(bbb_endpoint, bbb_secret, '1.8')
@bbb_server ||= BigBlueButton::BigBlueButtonApi.new(Rails.configuration.bigbluebutton_endpoint, Rails.configuration.bigbluebutton_secret, '1.8')
end
# Start a meeting for a specific room and returns the join URL.
......@@ -76,14 +76,4 @@ class BigBlueButtonApi
def decode_jwt(token)
JWT.decode token, bbb_secret, true, { algorithm: 'HS256' }
end
private
def bbb_endpoint
ENV.fetch 'BIGBLUEBUTTON_ENDPOINT', 'https://test-install.blindsidenetworks.com/bigbluebutton/api'
end
def bbb_secret
ENV.fetch 'BIGBLUEBUTTON_SECRET', '8cd8ef52e8e101574e400365b55e11a6'
end
end
......@@ -32,5 +32,10 @@ module Greenlight
ActiveModelSerializers.config.adapter = :json
config.active_storage.variant_processor = :mini_magick
config.bigbluebutton_endpoint = ENV.fetch('BIGBLUEBUTTON_ENDPOINT', 'https://test-install.blindsidenetworks.com/bigbluebutton/api')
config.bigbluebutton_endpoint = File.join(config.bigbluebutton_endpoint, '/api') unless config.bigbluebutton_endpoint.end_with?('api', 'api/')
config.bigbluebutton_secret = ENV.fetch('BIGBLUEBUTTON_SECRET', '8cd8ef52e8e101574e400365b55e11a6')
end
end
......@@ -7,14 +7,17 @@ describe BigBlueButtonApi, type: :service do
let(:bbb_service) { described_class.new }
before do
ENV['BIGBLUEBUTTON_ENDPOINT'] = 'http://test.com/bigbluebutton/api'
ENV['BIGBLUEBUTTON_SECRET'] = 'test'
Rails.configuration.bigbluebutton_endpoint = 'http://test.com/bigbluebutton/api'
Rails.configuration.bigbluebutton_secret = 'test'
end
describe 'Instance of BigBlueButtonApi being created' do
it 'Created an instance of BigBlueButtonApi' do
expect(BigBlueButton::BigBlueButtonApi).to receive(:new).with(ENV.fetch('BIGBLUEBUTTON_ENDPOINT', nil), ENV.fetch('BIGBLUEBUTTON_SECRET', nil),
'1.8')
expect(BigBlueButton::BigBlueButtonApi).to receive(:new).with(
Rails.configuration.bigbluebutton_endpoint,
Rails.configuration.bigbluebutton_secret,
'1.8'
)
bbb_service.bbb_server
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment