Skip to content
Snippets Groups Projects
Unverified Commit 990f72eb authored by farhatahmad's avatar farhatahmad Committed by GitHub
Browse files

Fixed issues with endpoint and conf check (#553)

parent 9467f756
No related branches found
No related tags found
No related merge requests found
......@@ -52,8 +52,8 @@ module Greenlight
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
# Use standalone BigBlueButton server.
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"] || config.bigbluebutton_endpoint_default
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"] || config.bigbluebutton_secret_default
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"].present? ? ENV["BIGBLUEBUTTON_ENDPOINT"] : config.bigbluebutton_endpoint_default
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"].present? ? ENV["BIGBLUEBUTTON_SECRET"] : config.bigbluebutton_secret_default
# Fix endpoint format if required.
config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/')
......
......@@ -16,15 +16,17 @@ namespace :conf do
end
passed
endpoint = fix_endpoint_format(ENV['BIGBLUEBUTTON_ENDPOINT'])
# Tries to establish a connection to the BBB server from Greenlight
print "Checking Connection"
test_request(ENV['BIGBLUEBUTTON_ENDPOINT'])
test_request(endpoint)
passed
# Tests the checksum on the getMeetings api call
print "Checking Secret"
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}getMeetings?checksum=#{checksum}")
test_request("#{endpoint}getMeetings?checksum=#{checksum}")
passed
if ENV['ALLOW_MAIL_NOTIFICATIONS'] == 'true'
......@@ -61,6 +63,15 @@ rescue => e
failed("Error connecting to BigBlueButton server - #{e}")
end
def fix_endpoint_format(url)
# Fix endpoint format if required.
url += "/" unless url.ends_with?('/')
url += "api/" if url.ends_with?('bigbluebutton/')
url += "bigbluebutton/api/" unless url.ends_with?('bigbluebutton/api/')
url
end
def failed(msg)
print(": Failed\n#{msg}\n")
exit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment