Skip to content
Snippets Groups Projects
Commit e0c59d83 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

aliases: allow configuring the separator

parent 6fbd7179
Branches
No related tags found
No related merge requests found
Pipeline #3887 passed
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"sources": [ "sources": [
{ {
"type": "aliases", "type": "aliases",
"path": "/etc/mail/aliases" "path": "/etc/mail/aliases",
"separator": ":"
}, },
{ {
"type": "passwd", "type": "passwd",
......
...@@ -4,6 +4,7 @@ from .. import Address ...@@ -4,6 +4,7 @@ from .. import Address
class Aliases: class Aliases:
def __init__(self, config): def __init__(self, config):
self._path = config["path"] self._path = config["path"]
self._separator = config["separator"]
def iter_all(self): def iter_all(self):
with open(self._path, "r") as fp: with open(self._path, "r") as fp:
...@@ -12,5 +13,5 @@ class Aliases: ...@@ -12,5 +13,5 @@ class Aliases:
continue continue
if line.startswith(":include:"): if line.startswith(":include:"):
raise NotImplementedError(":include") raise NotImplementedError(":include")
addr = line.split(":")[0] addr = line.split(self._separator)[0]
yield Address.from_str(addr) yield Address.from_str(addr)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment