NotificationConfig#

class rapidtools.gui.NotificationConfig(smtp_host: str = '', smtp_port: int = 587, smtp_user: str = '', smtp_password: str = '', smtp_from: str = '', smtp_ssl: bool = False, public_url: str = '')[source]#

Bases: object

Where notifications are sent from.

Variables:
  • smtp_host (str) – SMTP relay; empty disables email.

  • smtp_port (int) – Relay port.

  • smtp_user (str) – Login, empty for an open relay.

  • smtp_password (str) – Password for smtp_user.

  • smtp_from (str) – Sender address; defaults to smtp_user.

  • smtp_ssl (bool) – Use implicit TLS (port 465) instead of STARTTLS.

  • public_url (str) – The link put in messages; the server fills it with its own address when empty.

Example

>>> cfg = NotificationConfig.from_env({'RAPIDTOOLS_SMTP_HOST': 'mail.x.org'})
>>> cfg.smtp_host, cfg.smtp_port
('mail.x.org', 587)

Methods

from_env

Read the RAPIDTOOLS_SMTP_* variables, then apply overrides.

classmethod from_env(env: Mapping[str, str] | None = None, **overrides: Any)[source]#

Read the RAPIDTOOLS_SMTP_* variables, then apply overrides.

Parameters:
  • env (Mapping[str, str] | None) – Environment to read; os.environ by default.

  • **overrides – Field values that win over the environment (falsy values are ignored so CLI defaults do not mask variables).

Returns:

NotificationConfig – The merged configuration.