Skip to content

🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Support reading secrets from files

TEC220c9c89c501
diff --git a/backend/auth_routes.py b/backend/auth_routes.py
index e3fcd25..b5b900e 100644
--- a/backend/auth_routes.py
+++ b/backend/auth_routes.py
@@ -750,6 +750,8 @@ def send_password_reset_email(recipient_email, reset_link):
smtp_port = int(os.environ.get('SMTP_PORT', 1025))
smtp_username = os.environ.get('SMTP_USERNAME')
smtp_password = os.environ.get('SMTP_PASSWORD')
+ if os.environ.get('SMTP_PASSWORD_FILE'):
+ smtp_password = open(os.environ.get('SMTP_PASSWORD_FILE'), 'r').read().strip()
smtp_use_tls = os.environ.get('SMTP_USE_TLS', 'true').lower() == 'true'
smtp_use_ssl = os.environ.get('SMTP_USE_SSL', 'false').lower() == 'true'
sender_email = os.environ.get('SMTP_SENDER_EMAIL', '[email protected]')
diff --git a/backend/notifications.py b/backend/notifications.py
index e45eef6..b08873e 100644
--- a/backend/notifications.py
+++ b/backend/notifications.py
@@ -299,6 +299,8 @@ def process_email_notifications(all_warranties, eligible_user_ids, is_manual, ge
smtp_port = int(os.environ.get('SMTP_PORT', '1025'))
smtp_username = os.environ.get('SMTP_USERNAME', '[email protected]')
smtp_password = os.environ.get('SMTP_PASSWORD', '')
+ if os.environ.get('SMTP_PASSWORD_FILE'):
+ smtp_password = open(os.environ.get('SMTP_PASSWORD_FILE'), 'r').read().strip()
smtp_use_tls_env = os.environ.get('SMTP_USE_TLS', 'not_set').lower()
# For manual triggers, check email preferences
diff --git a/backend/oidc_handler.py b/backend/oidc_handler.py
index c77c475..854efb3 100644
--- a/backend/oidc_handler.py
+++ b/backend/oidc_handler.py
@@ -63,6 +63,8 @@ def init_oidc_client(current_app_instance, db_conn_func, db_release_func):
provider_name = os.environ.get('OIDC_PROVIDER_NAME', oidc_db_settings.get('oidc_provider_name', 'oidc'))
client_id = os.environ.get('OIDC_CLIENT_ID', oidc_db_settings.get('oidc_client_id', ''))
client_secret = os.environ.get('OIDC_CLIENT_SECRET', oidc_db_settings.get('oidc_client_secret', ''))
+ if os.environ.get('OIDC_CLIENT_SECRET_FILE'):
+ client_secret = open(os.environ.get('OIDC_CLIENT_SECRET_FILE'), 'r').read().strip()
issuer_url = os.environ.get('OIDC_ISSUER_URL', oidc_db_settings.get('oidc_issuer_url', ''))
scope = os.environ.get('OIDC_SCOPE', oidc_db_settings.get('oidc_scope', 'openid email profile'))