forked from External/greenlight
Add flag to enable/disable mail notifications
This commit is contained in:
parent
e94f3d7a10
commit
f763d8394e
|
@ -171,8 +171,10 @@ class BbbController < ApplicationController
|
||||||
RecordingCreatedJob.perform_later(token, parse_recording_for_view(rec_info))
|
RecordingCreatedJob.perform_later(token, parse_recording_for_view(rec_info))
|
||||||
|
|
||||||
# send an email to the owner of this recording, if defined
|
# send an email to the owner of this recording, if defined
|
||||||
owner = User.find_by(encrypted_id: token)
|
if Rails.configuration.mail_notifications
|
||||||
RecordingReadyEmailJob.perform_later(owner) if owner.present?
|
owner = User.find_by(encrypted_id: token)
|
||||||
|
RecordingReadyEmailJob.perform_later(owner) if owner.present?
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: remove the webhook now that the meeting and recording are done
|
# TODO: remove the webhook now that the meeting and recording are done
|
||||||
# remove only if the meeting is not running, otherwise the hook is needed
|
# remove only if the meeting is not running, otherwise the hook is needed
|
||||||
|
|
|
@ -38,35 +38,38 @@ module Greenlight
|
||||||
config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT']
|
config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT']
|
||||||
config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET']
|
config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET']
|
||||||
|
|
||||||
# GreenLight
|
config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] == "true"
|
||||||
config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS']
|
config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true"
|
||||||
config.smtp_from = ENV['SMTP_FROM']
|
|
||||||
config.smtp_server = ENV['SMTP_SERVER']
|
|
||||||
config.smtp_domain = ENV['SMTP_DOMAIN']
|
|
||||||
config.smtp_port = ENV['SMTP_PORT'] || 587
|
|
||||||
config.smtp_username = ENV['SMTP_USERNAME']
|
|
||||||
config.smtp_password = ENV['SMTP_PASSWORD']
|
|
||||||
config.smtp_auth = ENV['SMTP_AUTH'] || "login"
|
|
||||||
config.smtp_starttls_auto = ENV['SMTP_STARTTLS_AUTO'].nil? ? true : ENV['SMTP_STARTTLS_AUTO']
|
|
||||||
config.smtp_tls = ENV['SMTP_TLS'].nil? ? false : ENV['SMTP_TLS']
|
|
||||||
|
|
||||||
# SMTP
|
# SMTP and action mailer
|
||||||
config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] }
|
if config.mail_notifications
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.smtp_from = ENV['SMTP_FROM']
|
||||||
config.action_mailer.perform_deliveries = true
|
config.smtp_server = ENV['SMTP_SERVER']
|
||||||
config.action_mailer.raise_delivery_errors = true
|
config.smtp_domain = ENV['SMTP_DOMAIN']
|
||||||
config.action_mailer.smtp_settings = {
|
config.smtp_port = ENV['SMTP_PORT'] || 587
|
||||||
:address => config.smtp_server,
|
config.smtp_username = ENV['SMTP_USERNAME']
|
||||||
:domain => config.smtp_domain,
|
config.smtp_password = ENV['SMTP_PASSWORD']
|
||||||
:port => config.smtp_port,
|
config.smtp_auth = ENV['SMTP_AUTH'] || "login"
|
||||||
:user_name => config.smtp_username,
|
config.smtp_starttls_auto = ENV['SMTP_STARTTLS_AUTO'].nil? ? true : ENV['SMTP_STARTTLS_AUTO']
|
||||||
:password => config.smtp_password,
|
config.smtp_tls = ENV['SMTP_TLS'].nil? ? false : ENV['SMTP_TLS']
|
||||||
:authentication => config.smtp_auth,
|
|
||||||
:enable_starttls_auto => config.smtp_starttls_auto,
|
config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] }
|
||||||
:tls => config.smtp_tls
|
config.action_mailer.delivery_method = :smtp
|
||||||
}
|
config.action_mailer.perform_deliveries = true
|
||||||
config.action_mailer.default_options = {
|
config.action_mailer.raise_delivery_errors = true
|
||||||
from: config.smtp_from
|
config.action_mailer.smtp_settings = {
|
||||||
}
|
address: config.smtp_server,
|
||||||
|
domain: config.smtp_domain,
|
||||||
|
port: config.smtp_port,
|
||||||
|
user_name: config.smtp_username,
|
||||||
|
password: config.smtp_password,
|
||||||
|
authentication: config.smtp_auth,
|
||||||
|
enable_starttls_auto: config.smtp_starttls_auto,
|
||||||
|
tls: config.smtp_tls
|
||||||
|
}
|
||||||
|
config.action_mailer.default_options = {
|
||||||
|
from: config.smtp_from
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,10 @@ GREENLIGHT_USE_WEBHOOKS=false
|
||||||
# The web site domain, needed for emails mostly
|
# The web site domain, needed for emails mostly
|
||||||
GREENLIGHT_DOMAIN=localhost
|
GREENLIGHT_DOMAIN=localhost
|
||||||
|
|
||||||
# SMTP configurations
|
# Enable email notifications
|
||||||
|
GREENLIGHT_MAIL_NOTIFICATIONS=true
|
||||||
|
|
||||||
|
# Email configurations
|
||||||
SMTP_FROM=email@gmail.com
|
SMTP_FROM=email@gmail.com
|
||||||
SMTP_SERVER=smtp.gmail.com
|
SMTP_SERVER=smtp.gmail.com
|
||||||
SMTP_DOMAIN=gmail.com
|
SMTP_DOMAIN=gmail.com
|
||||||
|
|
Loading…
Reference in New Issue