From 787cea3e7fefdcc203fc5706aead89e5c8b0baeb Mon Sep 17 00:00:00 2001
From: anima
Date: Wed, 28 Oct 2026 19:03:55 +0100
Subject: [PATCH] #11 - fix password handling
---
README.md | 14 +++++++++++++-
main.py | 4 +++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index dbd214a..8d9d4fe 100644
--- a/README.md
+++ b/README.md
@@ -7,4 +7,16 @@ Dies ist eine neuentwicklung für Matrix, des bisher unter Discord laufenden Bot
- dynamic see [skills/](skills/)
## limits
-- this bot only supports handling with unencryptet channels!
\ No newline at end of file
+- this bot only supports handling with unencryptet channels!
+
+## usage
+1. fill the conf file
+2. run the bot
+
+hint: the password can be set as env var
+
+## env vars
+
+var | description | value options
+--- | --- | ---
+MATRIX_BOT_PASSWORD | password for the bot, overrides config! | string
diff --git a/main.py b/main.py
index e8a42b0..1bac7a5 100644
--- a/main.py
+++ b/main.py
@@ -46,7 +46,8 @@ class MatrixBot:
self.domain = self._config['general']['domain']
self.homeserver = f"https://{self.domain}"
self.username = f"@{self._config['general']['user']}:{self._config['general']['domain']}"
- self.__password = self._config['general']['pass']
+ # get password from env or fallback from config file
+ self.__password = os.environ.get('MATRIX_BOT_PASSWORD') or self._config['general']['pass']
del self._config['general']['pass']
return True
@@ -154,6 +155,7 @@ class MatrixBot:
async def run(self):
if await self._login():
+ del self.__password
await self.send_status(f"{self.botname} Online!")
await self._activate_skills()
await self.client.sync_forever(timeout=30000, set_presence='online')