forked from External/greenlight
Fixed issues with endpoint and conf check (#553)
This commit is contained in:
parent
9467f756e2
commit
990f72ebf4
|
@ -52,8 +52,8 @@ module Greenlight
|
||||||
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
|
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
|
||||||
|
|
||||||
# Use standalone BigBlueButton server.
|
# Use standalone BigBlueButton server.
|
||||||
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"] || config.bigbluebutton_endpoint_default
|
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"].present? ? ENV["BIGBLUEBUTTON_ENDPOINT"] : config.bigbluebutton_endpoint_default
|
||||||
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"] || config.bigbluebutton_secret_default
|
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"].present? ? ENV["BIGBLUEBUTTON_SECRET"] : config.bigbluebutton_secret_default
|
||||||
|
|
||||||
# Fix endpoint format if required.
|
# Fix endpoint format if required.
|
||||||
config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/')
|
config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/')
|
||||||
|
|
|
@ -16,15 +16,17 @@ namespace :conf do
|
||||||
end
|
end
|
||||||
passed
|
passed
|
||||||
|
|
||||||
|
endpoint = fix_endpoint_format(ENV['BIGBLUEBUTTON_ENDPOINT'])
|
||||||
|
|
||||||
# Tries to establish a connection to the BBB server from Greenlight
|
# Tries to establish a connection to the BBB server from Greenlight
|
||||||
print "Checking Connection"
|
print "Checking Connection"
|
||||||
test_request(ENV['BIGBLUEBUTTON_ENDPOINT'])
|
test_request(endpoint)
|
||||||
passed
|
passed
|
||||||
|
|
||||||
# Tests the checksum on the getMeetings api call
|
# Tests the checksum on the getMeetings api call
|
||||||
print "Checking Secret"
|
print "Checking Secret"
|
||||||
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
|
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
|
||||||
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}getMeetings?checksum=#{checksum}")
|
test_request("#{endpoint}getMeetings?checksum=#{checksum}")
|
||||||
passed
|
passed
|
||||||
|
|
||||||
if ENV['ALLOW_MAIL_NOTIFICATIONS'] == 'true'
|
if ENV['ALLOW_MAIL_NOTIFICATIONS'] == 'true'
|
||||||
|
@ -61,6 +63,15 @@ rescue => e
|
||||||
failed("Error connecting to BigBlueButton server - #{e}")
|
failed("Error connecting to BigBlueButton server - #{e}")
|
||||||
end
|
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)
|
def failed(msg)
|
||||||
print(": Failed\n#{msg}\n")
|
print(": Failed\n#{msg}\n")
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in New Issue