mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 00:54:32 +08:00
Deprecate MAIL_SERVER_URL variable, add WEB_SERVER_URL as replacement [SCI-11022] (#8183)
This commit is contained in:
parent
3cb59b2430
commit
b935f40bd0
7 changed files with 17 additions and 26 deletions
|
@ -14,13 +14,13 @@ module MailerHelper
|
|||
private
|
||||
|
||||
def prepend_server_url(href)
|
||||
return href if href.start_with? ENV['MAIL_SERVER_URL']
|
||||
return href if href.start_with? Rails.application.config.action_mailer.default_url_options[:host]
|
||||
|
||||
new_href = ''
|
||||
unless ENV['MAIL_SERVER_URL'].start_with?('http://', 'https://')
|
||||
unless Rails.application.config.action_mailer.default_url_options[:host].start_with?('http://', 'https://')
|
||||
new_href += 'http://'
|
||||
end
|
||||
new_href += ENV['MAIL_SERVER_URL']
|
||||
new_href += Rails.application.config.action_mailer.default_url_options[:host]
|
||||
new_href += ((href.start_with? '/') ? '' : '/')
|
||||
new_href += href
|
||||
new_href
|
||||
|
|
|
@ -182,6 +182,6 @@ class ProjectsJsonExportService
|
|||
end
|
||||
|
||||
def asset_url(asset)
|
||||
ENV['MAIL_SERVER_URL'] + Rails.application.routes.url_helpers.asset_file_url_path(asset)
|
||||
Rails.application.routes.url_helpers.asset_file_url_url(asset)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,15 +42,17 @@ Rails.application.configure do
|
|||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = ENV['ACTIVESTORAGE_SERVICE'] || :local
|
||||
|
||||
Rails.application.routes.default_url_options = {
|
||||
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL'] || 'localhost'
|
||||
}
|
||||
|
||||
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
Rails.application.routes.default_url_options = {
|
||||
host: Rails.application.secrets.mail_server_url
|
||||
}
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
|
@ -104,7 +106,6 @@ Rails.application.configure do
|
|||
else
|
||||
config.x.new_team_on_signup = false
|
||||
end
|
||||
config.hosts << "dev.scinote.test"
|
||||
|
||||
# Automatically update js-routes file
|
||||
# when routes.rb is changed
|
||||
|
|
|
@ -17,13 +17,10 @@ Rails.application.configure do
|
|||
config.action_controller.perform_caching = true
|
||||
|
||||
Rails.application.routes.default_url_options = {
|
||||
host: Rails.application.secrets.mail_server_url
|
||||
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL']
|
||||
}
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.default_url_options = {
|
||||
host: Rails.application.secrets.mail_server_url
|
||||
}
|
||||
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||
config.action_mailer.default_options = {
|
||||
from: Rails.application.secrets.mailer_from,
|
||||
reply_to: Rails.application.secrets.mailer_reply_to
|
||||
|
|
|
@ -36,12 +36,13 @@ Rails.application.configure do
|
|||
# Store uploaded files on the local file system in a temporary directory.
|
||||
config.active_storage.service = :test
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
Rails.application.routes.default_url_options = {
|
||||
host: Rails.application.secrets.mail_server_url
|
||||
host: ENV['WEB_SERVER_URL'] || ENV['MAIL_SERVER_URL'] || 'localhost'
|
||||
}
|
||||
|
||||
config.action_mailer.default_url_options = { host: Rails.application.routes.default_url_options[:host] }
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
|
|
|
@ -20,14 +20,6 @@
|
|||
|
||||
common: &common
|
||||
|
||||
# ======================================================================
|
||||
# Server address is used for mailer (in "confirm new email/..." emails,
|
||||
# SciNote needs to know onto which URL to redirect the user for
|
||||
# confirmation page)
|
||||
# ======================================================================
|
||||
|
||||
mail_server_url: <%= ENV["MAIL_SERVER_URL"] || "localhost" %>
|
||||
|
||||
# ======================================================================
|
||||
# Mailer configuration to define from which SMTP server to send
|
||||
# e-mails.
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'active_storage/service/disk_service'
|
|||
module ActiveStorage
|
||||
class Service::CustomDiskService < Service::DiskService
|
||||
def url_options
|
||||
ActiveStorage::Current.url_options ||= { host: Rails.application.secrets.mail_server_url }
|
||||
ActiveStorage::Current.url_options ||= { host: Rails.application.routes.default_url_options[:host] }
|
||||
ActiveStorage::Current.url_options
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue