fixes after manual test
This commit is contained in:
parent
53a275605f
commit
0520174bf3
3
Makefile
3
Makefile
@ -2,3 +2,6 @@
|
|||||||
|
|
||||||
shell:
|
shell:
|
||||||
MYPYPATH=`pipenv --venv`/lib/python3.11/site-packages pipenv shell
|
MYPYPATH=`pipenv --venv`/lib/python3.11/site-packages pipenv shell
|
||||||
|
|
||||||
|
test:
|
||||||
|
pipenv run python -m unittest mail4one/*test.py
|
||||||
|
@ -42,6 +42,7 @@ class TLSCfg(Jata):
|
|||||||
class ServerCfg(Jata):
|
class ServerCfg(Jata):
|
||||||
host: str = "default"
|
host: str = "default"
|
||||||
port: int
|
port: int
|
||||||
|
# disabled: bool = False
|
||||||
tls: TLSCfg | str = "default"
|
tls: TLSCfg | str = "default"
|
||||||
|
|
||||||
|
|
||||||
@ -63,16 +64,16 @@ class SmtpCfg(ServerCfg):
|
|||||||
class Config(Jata):
|
class Config(Jata):
|
||||||
default_tls: TLSCfg | None
|
default_tls: TLSCfg | None
|
||||||
default_host: str = '0.0.0.0'
|
default_host: str = '0.0.0.0'
|
||||||
|
|
||||||
mails_path: str
|
|
||||||
users: list[User]
|
|
||||||
boxes: list[Mbox]
|
|
||||||
matches: list[Match]
|
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
|
|
||||||
pop: PopCfg | None
|
mails_path: str
|
||||||
smtp_starttls: SmtpStartTLSCfg | None
|
matches: list[Match]
|
||||||
smtp: SmtpCfg | None
|
boxes: list[Mbox]
|
||||||
|
users: list[User]
|
||||||
|
|
||||||
|
pop: PopCfg | None = None
|
||||||
|
smtp_starttls: SmtpStartTLSCfg | None = None
|
||||||
|
smtp: SmtpCfg | None = None
|
||||||
# smtp_port_submission = 587
|
# smtp_port_submission = 587
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,22 +85,22 @@ async def a_main(cfg: config.Config) -> None:
|
|||||||
servers.append(smtp_server)
|
servers.append(smtp_server)
|
||||||
|
|
||||||
if servers:
|
if servers:
|
||||||
await asyncio.gather(server.serve_forever() for server in servers)
|
await asyncio.gather(*[server.serve_forever() for server in servers])
|
||||||
else:
|
else:
|
||||||
logging.warn("Nothing to do!")
|
logging.warn("Nothing to do!")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main() -> None:
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("config_path", type=Path)
|
parser.add_argument("config_path", type=Path)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
config = Config(args.config_path.read_text())
|
cfg = config.Config(args.config_path.read_text())
|
||||||
|
|
||||||
setup_logging(args)
|
setup_logging(cfg)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.set_debug(config.debug)
|
loop.set_debug(cfg.debug)
|
||||||
|
|
||||||
asyncio.run(a_main(config))
|
asyncio.run(a_main(cfg))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user