okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 1 | from oslo_config import cfg |
| 2 | from staffeln.i18n import _ |
| 3 | |
| 4 | notify_group = cfg.OptGroup( |
| 5 | "notification", |
| 6 | title="Notification options", |
okozachenko | 24bfc9e | 2021-05-04 15:20:11 +0300 | [diff] [blame] | 7 | help=_("Options under this group are used to define notification settings."), |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 8 | ) |
| 9 | |
| 10 | email_opts = [ |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 11 | cfg.ListOpt( |
| 12 | "receiver", |
| 13 | default=[], |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 14 | help=_( |
| 15 | "The receivers of the bakcup result by email." |
| 16 | "A list of addresses to receive backup result emails to. A bare" |
| 17 | " string will be treated as a list with 1 address." |
| 18 | ), |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 19 | ), |
| 20 | cfg.StrOpt( |
ricolin | e6e56e1 | 2023-01-31 12:45:59 +0800 | [diff] [blame] | 21 | "project_receiver_domain", |
| 22 | help=_( |
| 23 | "The project receiver domain that will be combine with project " |
| 24 | "name as project report receive target email address. " |
| 25 | "Format: $(project_name)@project_receiver_domain" |
| 26 | ), |
| 27 | ), |
| 28 | cfg.StrOpt( |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 29 | "sender_email", |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 30 | help=_( |
| 31 | "Log in on an SMTP server that requires authentication." |
| 32 | "The user name to authenticate with." |
| 33 | ), |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 34 | ), |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 35 | # We can remove the sender password as we are using postfix to send mail and we won't be authenticating. |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 36 | cfg.StrOpt( |
| 37 | "sender_pwd", |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 38 | help=_( |
| 39 | "Log in on an SMTP server that requires authentication." |
| 40 | "The password for the authentication." |
| 41 | ), |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 42 | ), |
| 43 | cfg.StrOpt( |
| 44 | "smtp_server_domain", |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 45 | default="localhost", |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 46 | help=_("the name of the remote host to which to connect"), |
| 47 | ), |
| 48 | cfg.StrOpt( |
| 49 | "smtp_server_port", |
Susanta Gautam | 77398c2 | 2021-05-07 20:50:23 +0545 | [diff] [blame] | 50 | default="25", |
okozachenko | f787cdc | 2021-05-04 11:46:54 +0300 | [diff] [blame] | 51 | help=_("the port to which to connect"), |
| 52 | ), |
| 53 | ] |
| 54 | |
| 55 | |
| 56 | def register_opts(conf): |
| 57 | conf.register_group(notify_group) |
| 58 | conf.register_opts(email_opts, group=notify_group) |
| 59 | |
| 60 | |
| 61 | def list_opts(): |
| 62 | return {notify_group: email_opts} |