Skip to content
Snippets Groups Projects
Commit e22d163a authored by John Ma's avatar John Ma Committed by Jesus Federico
Browse files

Fixed #305 Added smtp check to rakefile (GRN-42) (#313)

* <Added conf check for smtp server>

* <fixed code style>
parent de98fd0a
No related branches found
No related tags found
No related merge requests found
...@@ -28,9 +28,28 @@ namespace :conf do ...@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment