okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 1 | from oslo_config import cfg |
| 2 | from staffeln.i18n import _ |
| 3 | |
okozachenko | 24bfc9e | 2021-05-04 15:20:11 +0300 | [diff] [blame] | 4 | |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 5 | notify_group = cfg.OptGroup( |
| 6 | "notification", |
| 7 | title="Notification options", |
okozachenko | 24bfc9e | 2021-05-04 15:20:11 +0300 | [diff] [blame] | 8 | help=_("Options under this group are used to define notification settings."), |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 9 | ) |
| 10 | |
| 11 | email_opts = [ |
| 12 | cfg.StrOpt( |
| 13 | "template", |
okozachenko | 301d50b | 2021-05-05 10:35:15 +0300 | [diff] [blame] | 14 | default="<h3>\${CONTENT}</h3>", |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 15 | help=_("This html template is used to email the backup result."), |
| 16 | ), |
| 17 | cfg.ListOpt( |
| 18 | "receiver", |
| 19 | default=[], |
| 20 | help=_("The receivers of the bakcup result by email." |
| 21 | "A list of addresses to receive backup result emails to. A bare" |
| 22 | " string will be treated as a list with 1 address."), |
| 23 | ), |
| 24 | cfg.StrOpt( |
| 25 | "sender_email", |
| 26 | help=_("Log in on an SMTP server that requires authentication." |
| 27 | "The user name to authenticate with." |
| 28 | ), |
| 29 | ), |
| 30 | cfg.StrOpt( |
| 31 | "sender_pwd", |
| 32 | help=_("Log in on an SMTP server that requires authentication." |
| 33 | "The password for the authentication." |
| 34 | ), |
| 35 | ), |
| 36 | cfg.StrOpt( |
| 37 | "smtp_server_domain", |
| 38 | default="smtp.gmail.com", |
| 39 | help=_("the name of the remote host to which to connect"), |
| 40 | ), |
| 41 | cfg.StrOpt( |
| 42 | "smtp_server_port", |
| 43 | default="587", |
| 44 | help=_("the port to which to connect"), |
| 45 | ), |
| 46 | ] |
| 47 | |
| 48 | |
| 49 | def register_opts(conf): |
| 50 | conf.register_group(notify_group) |
| 51 | conf.register_opts(email_opts, group=notify_group) |
| 52 | |
| 53 | |
| 54 | def list_opts(): |
| 55 | return {notify_group: email_opts} |