From 1238ed95da7a0f449b7b98d8a2b004ee28a70d25 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sun, 28 Jul 2024 16:24:17 +0200 Subject: [PATCH] remove mailboxes_dir as default option --- CHANGELOG.md | 17 ++++++++--------- chatmaild/src/chatmaild/config.py | 12 ++++++++++-- chatmaild/src/chatmaild/ini/chatmail.ini.f | 3 --- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89bd5cf2..c89309d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,22 +6,21 @@ outside by accepting their localized "encrypted subject" strings. ([#370](https://github.com/deltachat/chatmail/pull/370)) -- migrate and remove sqlite database in favor of password/lastlogin tracking - in a user's maildir. This removes the need for "passdb_path" setting in ini file - which was introduced through #351 below. +- Migrate and remove sqlite database in favor of password/lastlogin tracking + in a user's maildir. ([#379](https://github.com/deltachat/chatmail/pull/379)) - Require pyinfra V3 installed on the client side, run `./scripts/initenv.sh` to upgrade locally. ([#378](https://github.com/deltachat/chatmail/pull/378)) -- BREAKING: new required chatmail.ini values: - - mailboxes_dir = /home/vmail/mail/{mail_domain} - passdb = /home/vmail/passdb.sqlite - - reducing hardcoding these two paths all over the files, also improving testability. +- don't hardcode "/home/vmail" paths but rather set them + once in the config object and use it everywhere else, + thereby also improving testability. ([#351](https://github.com/deltachat/chatmail/pull/351)) + temporarily introduced obligatory "passdb_path" and "mailboxes_dir" + settings but they were removed/obsoleted in + ([#380](https://github.com/deltachat/chatmail/pull/380)) - BREAKING: new required chatmail.ini value 'delete_inactive_users_after = 100' which removes users from database and mails after 100 days without any login. diff --git a/chatmaild/src/chatmaild/config.py b/chatmaild/src/chatmaild/config.py index 9165750e..c71e0b27 100644 --- a/chatmaild/src/chatmaild/config.py +++ b/chatmaild/src/chatmaild/config.py @@ -27,7 +27,6 @@ class Config: self.password_min_length = int(params["password_min_length"]) self.passthrough_senders = params["passthrough_senders"].split() self.passthrough_recipients = params["passthrough_recipients"].split() - self.mailboxes_dir = Path(params["mailboxes_dir"].strip()) self.filtermail_smtp_port = int(params["filtermail_smtp_port"]) self.postfix_reinject_port = int(params["postfix_reinject_port"]) self.iroh_relay = params.get("iroh_relay") @@ -36,6 +35,10 @@ class Config: self.privacy_pdo = params.get("privacy_pdo") self.privacy_supervisor = params.get("privacy_supervisor") + # deprecated option + mbdir = params.get("mailboxes_dir", f"/home/vmail/mail/{self.mail_domain}") + self.mailboxes_dir = Path(mbdir.strip()) + # old unused option (except for first migration from sqlite to maildir store) self.passdb_path = Path(params.get("passdb_path", "/home/vmail/passdb.sqlite")) @@ -65,14 +68,19 @@ def write_initial_config(inipath, mail_domain, overrides): # apply config overrides new_lines = [] + extra = overrides.copy() for line in content.split("\n"): new_line = line.strip() if new_line and new_line[0] not in "#[": name, value = map(str.strip, new_line.split("=", maxsplit=1)) - value = overrides.get(name, value) + value = overrides.pop(name, value) new_line = f"{name} = {value}" new_lines.append(new_line) + for name, value in extra.items(): + new_line = f"{name} = {value}" + new_lines.append(new_line) + content = "\n".join(new_lines) # apply testrun privacy overrides diff --git a/chatmaild/src/chatmaild/ini/chatmail.ini.f b/chatmaild/src/chatmaild/ini/chatmail.ini.f index fea7b9cd..1b951356 100644 --- a/chatmaild/src/chatmaild/ini/chatmail.ini.f +++ b/chatmaild/src/chatmaild/ini/chatmail.ini.f @@ -42,9 +42,6 @@ passthrough_recipients = xstore@testrun.org groupsbot@hispanilandia.net # Deployment Details # -# Directory where user mailboxes are stored -mailboxes_dir = /home/vmail/mail/{mail_domain} - # where the filtermail SMTP service listens filtermail_smtp_port = 10080