From e0c59d83966cd78ff97aa2f797bb558d43fcd2ff Mon Sep 17 00:00:00 2001 From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de> Date: Sat, 19 Mar 2022 17:51:29 +0100 Subject: [PATCH] aliases: allow configuring the separator --- config.sample.json | 3 ++- rezelist/backends/aliases.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.sample.json b/config.sample.json index 8dc9137..4066986 100644 --- a/config.sample.json +++ b/config.sample.json @@ -12,7 +12,8 @@ "sources": [ { "type": "aliases", - "path": "/etc/mail/aliases" + "path": "/etc/mail/aliases", + "separator": ":" }, { "type": "passwd", diff --git a/rezelist/backends/aliases.py b/rezelist/backends/aliases.py index 4e9bbcd..3d1ae35 100644 --- a/rezelist/backends/aliases.py +++ b/rezelist/backends/aliases.py @@ -4,6 +4,7 @@ from .. import Address class Aliases: def __init__(self, config): self._path = config["path"] + self._separator = config["separator"] def iter_all(self): with open(self._path, "r") as fp: @@ -12,5 +13,5 @@ class Aliases: continue if line.startswith(":include:"): raise NotImplementedError(":include") - addr = line.split(":")[0] + addr = line.split(self._separator)[0] yield Address.from_str(addr) -- GitLab