forked from External/greenlight
* <Added conf check for smtp server> * <fixed code style>
This commit is contained in:
parent
de98fd0a3c
commit
e22d163a3f
|
@ -28,9 +28,28 @@ namespace :conf do
|
||||||
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
|
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
|
||||||
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}api/getMeetings?checksum=#{checksum}")
|
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}api/getMeetings?checksum=#{checksum}")
|
||||||
passed
|
passed
|
||||||
|
|
||||||
|
# Tests the checksum on the getMeetings api call
|
||||||
|
print "Checking SMTP connection"
|
||||||
|
test_smtp
|
||||||
|
passed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_smtp
|
||||||
|
smtp = Net::SMTP.new(ENV['SMTP_SERVER'], ENV['SMTP_PORT'])
|
||||||
|
if ENV['SMTP_STARTTLS_AUTO']
|
||||||
|
smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)
|
||||||
|
end
|
||||||
|
|
||||||
|
smtp.start(ENV['SMTP_DOMAIN'], ENV['SMTP_USERNAME'], ENV['SMTP_PASSWORD'],
|
||||||
|
ENV['SMTP_AUTH']) do |s|
|
||||||
|
s.sendmail('test', ENV['SMTP_USERNAME'], 'notifications@example.com')
|
||||||
|
end
|
||||||
|
rescue => exc
|
||||||
|
failed("Error connecting to SMTP - #{exc}")
|
||||||
|
end
|
||||||
|
|
||||||
# takes the full URL including the protocol
|
# takes the full URL including the protocol
|
||||||
def test_request(url)
|
def test_request(url)
|
||||||
uri = URI(url)
|
uri = URI(url)
|
||||||
|
|
Loading…
Reference in New Issue