-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
harmonized url building for notification and email messages
* introduce new env variable PUBLIC_URL (uri) * warning: deprecate SMTP_HOST variable to build url in email body * dry email configuration * email delivery disabled if SMTP_ADDRESS is set or if DISABLE_MAIL_DELIVERY * use app.root_url to build url in notification * NB: PUBLIC_URL: is intended to be used in container environments to point to the public web entrypoint of the Chemotion instance
- Loading branch information
Showing
7 changed files
with
58 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Rails.application.configure do | ||
uri = URI.parse(config.root_url) | ||
scheme = uri.scheme | ||
host = uri.host | ||
port = uri.port | ||
|
||
config.action_mailer.raise_delivery_errors = true if Rails.env.production? | ||
config.action_mailer.perform_caching = false | ||
config.action_mailer.default_url_options = { host: host, protocol: scheme, port: port } | ||
config.action_mailer.delivery_method = :smtp unless Rails.env.test? | ||
config.action_mailer.smtp_settings = { | ||
address: ENV['SMTP_ADDRESS'], | ||
port: ENV['SMTP_PORT'], | ||
user_name: ENV['SMTP_USERNAME'], | ||
domain: ENV['SMTP_DOMAIN'], | ||
password: ENV['SMTP_PASSWORD'], | ||
authentication: ENV['SMTP_AUTH'] && ENV['SMTP_AUTH'].to_sym, | ||
enable_starttls_auto: ENV['SMTP_TLS'] && ENV['SMTP_TLS'].match(/true/), | ||
openssl_verify_mode: ENV['SMTP_SSL_MODE'] | ||
} | ||
|
||
if ENV['SMTP_ADDRESS'].blank? || ENV['DISABLE_MAIL_DELIVERY'].present? | ||
config.action_mailer.perform_deliveries = false | ||
end | ||
end | ||
|