Fixed issues with endpoint and conf check (#553)

This commit is contained in:
farhatahmad 2019-05-23 17:08:43 -04:00 committed by GitHub
parent 9467f756e2
commit 990f72ebf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -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?('/')

View File

@ -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