diff --git a/backend/app/core/apprise.py b/backend/app/core/apprise.py index 00895f38f..969bbecde 100644 --- a/backend/app/core/apprise.py +++ b/backend/app/core/apprise.py @@ -11,7 +11,7 @@ class AppriseService: self.smtp_host = os.getenv("SMTP_HOST") self.smtp_port = int(os.getenv("SMTP_PORT", "587")) self.smtp_username = os.getenv("SMTP_USERNAME") - self.smtp_password = os.getenv("SMTP_PASSWORD") + self.smtp_password = core_config.read_secret("SMTP_PASSWORD") self.smtp_secure = os.getenv("SMTP_SECURE", "true").lower() self.smtp_secure_type = os.getenv("SMTP_SECURE_TYPE", "starttls").lower() self.frontend_host = core_config.ENDURAIN_HOST diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 71f719fdf..b170bd340 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -249,7 +249,8 @@ def check_required_env_vars(): # Email is optional but warn if not configured email_vars = ["SMTP_HOST", "SMTP_USERNAME", "SMTP_PASSWORD"] for var in email_vars: - if var not in os.environ: + value = read_secret(var) if var == "SMTP_PASSWORD" else os.getenv(var) + if not value: core_logger.print_to_log_and_console( f"Email not configured (missing: {var}). Password reset feature will not work.", "info", diff --git a/docs/getting-started/advanced-started.md b/docs/getting-started/advanced-started.md index d9f399efb..9f64d6a98 100644 --- a/docs/getting-started/advanced-started.md +++ b/docs/getting-started/advanced-started.md @@ -50,7 +50,7 @@ Table below shows supported environment variables. Variables marked with optiona | SMTP_HOST | No default set | Yes | The SMTP host of your email provider. Example `smtp.protonmail.ch` | | SMTP_PORT | 587 | Yes | The SMTP port of your email provider. Default is 587 | | SMTP_USERNAME | No default set | Yes | The username of your SMTP email provider, probably your email address | -| SMTP_PASSWORD | No default set | Yes | The password of your SMTP email provider. Some providers allow the use of your account password, others require the creation of an app password. Please refer to your provider documentation | +| SMTP_PASSWORD | No default set | Yes | The password of your SMTP email provider. Some providers allow the use of your account password, others require the creation of an app password. Please refer to your provider documentation. Alternatively, use `SMTP_PASSWORD_FILE` for Docker secrets | | SMTP_SECURE | true | Yes | By default it uses secure communications. Accepted values are `true` and `false` | | SMTP_SECURE_TYPE | starttls | Yes | If SMTP_SECURE is set you can set the communication type. Accepted values are `starttls` and `ssl` | @@ -77,6 +77,7 @@ Endurain supports [Docker secrets](https://docs.docker.com/compose/how-tos/use-s - `DB_PASSWORD` → `DB_PASSWORD_FILE` - `SECRET_KEY` → `SECRET_KEY_FILE` - `FERNET_KEY` → `FERNET_KEY_FILE` +- `SMTP_PASSWORD` → `SMTP_PASSWORD_FILE` ### Using File-Based Secrets