Merge "Add a configurable fallback URL for emails"
This commit is contained in:
commit
d8316e0c45
@ -168,6 +168,9 @@ lock_path = $state_path/lock
|
||||
# The email address of the Reply-To header (optional).
|
||||
# reply_to =
|
||||
|
||||
# The default url base to use in emails, if Referer is not set.
|
||||
# default_url = https://storyboard.openstack.org/
|
||||
|
||||
# The SMTP server to use.
|
||||
# smtp_host = localhost
|
||||
|
||||
|
@ -33,6 +33,9 @@ PLUGIN_OPTS = [
|
||||
cfg.StrOpt("reply_to",
|
||||
default=None,
|
||||
help="The email address of the Reply-To header (optional)."),
|
||||
cfg.StrOpt("default_url",
|
||||
default=None,
|
||||
help="The default/fallback url base to use in emails."),
|
||||
cfg.StrOpt("smtp_host",
|
||||
default='localhost',
|
||||
help="The SMTP server to use."),
|
||||
|
@ -282,6 +282,10 @@ class SubscriptionEmailWorker(EmailWorkerBase):
|
||||
if email_config.reply_to:
|
||||
factory.add_header('Reply-To', email_config.reply_to)
|
||||
|
||||
# If there is a fallback URL configured, use it if needed
|
||||
if email_config.default_url and url is None:
|
||||
url = email_config.default_url
|
||||
|
||||
# Resolve the resource instance
|
||||
resource_instance = self.resolve_resource_by_name(session, resource,
|
||||
resource_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user