mirror of
https://github.com/chatmail/relay.git
synced 2026-05-12 00:54:37 +00:00
Compare commits
45 Commits
draft-init
...
rename_dep
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04e3a4eef7 | ||
|
|
cf6ed68a12 | ||
|
|
cad1d32682 | ||
|
|
fd10652f48 | ||
|
|
02918de6c1 | ||
|
|
e27dd84501 | ||
|
|
cdbda291c5 | ||
|
|
d70eb78a76 | ||
|
|
a5e4562505 | ||
|
|
3f2eb84323 | ||
|
|
613d3e14ea | ||
|
|
453c401ac6 | ||
|
|
8b756f2e0c | ||
|
|
9e9d5b7698 | ||
|
|
02adb758ff | ||
|
|
ffade66d97 | ||
|
|
988333d5fd | ||
|
|
db41e952e3 | ||
|
|
bb1b11df15 | ||
|
|
b3fdebf8df | ||
|
|
4615df2e3b | ||
|
|
73d8e01452 | ||
|
|
bf8a99d844 | ||
|
|
cb19ac34e3 | ||
|
|
15e5573ab4 | ||
|
|
74f5b2847f | ||
|
|
e417e43c54 | ||
|
|
158ebe1089 | ||
|
|
5fb7833677 | ||
|
|
587d8142d2 | ||
|
|
a6d24b3af7 | ||
|
|
d730af2e69 | ||
|
|
99b1e18b0a | ||
|
|
6012039c56 | ||
|
|
f388e86287 | ||
|
|
d3ca037ebf | ||
|
|
00a203c9aa | ||
|
|
6bffb5470d | ||
|
|
81c4a6170f | ||
|
|
6285283b02 | ||
|
|
b71e24d6a1 | ||
|
|
a4e48c9919 | ||
|
|
bc27eb58bf | ||
|
|
1b1f9365c9 | ||
|
|
d8c8040f07 |
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
run: cmdeploy fmt -v
|
run: cmdeploy fmt -v
|
||||||
|
|
||||||
- name: run deploy-chatmail offline tests
|
- name: run deploy-chatmail offline tests
|
||||||
run: pytest tests
|
run: pytest --pyargs cmdeploy
|
||||||
|
|
||||||
- name: initialize with chatmail domain
|
- name: initialize with chatmail domain
|
||||||
run: cmdeploy init chat.example.org
|
run: cmdeploy init chat.example.org
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ def read_config(inipath):
|
|||||||
class Config:
|
class Config:
|
||||||
def __init__(self, inipath, params):
|
def __init__(self, inipath, params):
|
||||||
self._inipath = inipath
|
self._inipath = inipath
|
||||||
self.mailname = self.mail_domain = params["mailname"]
|
self.mail_domain = params["mail_domain"]
|
||||||
self.max_user_send_per_minute = int(params["max_user_send_per_minute"])
|
self.max_user_send_per_minute = int(params["max_user_send_per_minute"])
|
||||||
self.filtermail_smtp_port = int(params["filtermail_smtp_port"])
|
self.filtermail_smtp_port = int(params["filtermail_smtp_port"])
|
||||||
self.postfix_reinject_port = int(params["postfix_reinject_port"])
|
self.postfix_reinject_port = int(params["postfix_reinject_port"])
|
||||||
@@ -23,12 +23,14 @@ class Config:
|
|||||||
return open(self._inipath, "rb")
|
return open(self._inipath, "rb")
|
||||||
|
|
||||||
|
|
||||||
def write_initial_config(inipath, mailname):
|
def write_initial_config(inipath, mail_domain):
|
||||||
from importlib.resources import files
|
from importlib.resources import files
|
||||||
|
|
||||||
inidir = files(__package__).joinpath("ini")
|
inidir = files(__package__).joinpath("ini")
|
||||||
content = inidir.joinpath("chatmail.ini.f").read_text().format(mailname=mailname)
|
content = (
|
||||||
if mailname.endswith(".testrun.org"):
|
inidir.joinpath("chatmail.ini.f").read_text().format(mail_domain=mail_domain)
|
||||||
|
)
|
||||||
|
if mail_domain.endswith(".testrun.org"):
|
||||||
override_inipath = inidir.joinpath("override-testrun.ini")
|
override_inipath = inidir.joinpath("override-testrun.ini")
|
||||||
privacy = iniconfig.IniConfig(override_inipath)["privacy"]
|
privacy = iniconfig.IniConfig(override_inipath)["privacy"]
|
||||||
lines = []
|
lines = []
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[params]
|
[params]
|
||||||
|
|
||||||
# mail domain (MUST be set to fully qualified chat mail domain)
|
# mail domain (MUST be set to fully qualified chat mail domain)
|
||||||
mailname = {mailname}
|
mail_domain = {mail_domain}
|
||||||
|
|
||||||
#
|
#
|
||||||
# If you only do private test deploys, you don't need to modify any settings below
|
# If you only do private test deploys, you don't need to modify any settings below
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
|
|
||||||
mailname_path = "/etc/mailname"
|
mail_domain_path = "/etc/mailname"
|
||||||
|
|
||||||
|
|
||||||
def create_newemail_dict(domain):
|
def create_newemail_dict(domain):
|
||||||
@@ -16,7 +16,7 @@ def create_newemail_dict(domain):
|
|||||||
|
|
||||||
|
|
||||||
def print_new_account():
|
def print_new_account():
|
||||||
domain = open(mailname_path).read().strip()
|
domain = open(mail_domain_path).read().strip()
|
||||||
creds = create_newemail_dict(domain=domain)
|
creds = create_newemail_dict(domain=domain)
|
||||||
|
|
||||||
print("Content-Type: application/json")
|
print("Content-Type: application/json")
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ from chatmaild.config import read_config, write_initial_config
|
|||||||
def make_config(tmp_path):
|
def make_config(tmp_path):
|
||||||
inipath = tmp_path.joinpath("chatmail.ini")
|
inipath = tmp_path.joinpath("chatmail.ini")
|
||||||
|
|
||||||
def make_conf(mailname):
|
def make_conf(mail_domain):
|
||||||
write_initial_config(inipath, mailname=mailname)
|
write_initial_config(inipath, mail_domain=mail_domain)
|
||||||
return read_config(inipath)
|
return read_config(inipath)
|
||||||
|
|
||||||
return make_conf
|
return make_conf
|
||||||
@@ -27,7 +27,7 @@ def example_config(make_config):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def maildomain(example_config):
|
def maildomain(example_config):
|
||||||
return example_config.mailname
|
return example_config.mail_domain
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from chatmaild.config import read_config
|
|||||||
|
|
||||||
def test_read_config_basic(make_config):
|
def test_read_config_basic(make_config):
|
||||||
config = make_config("chat.example.org")
|
config = make_config("chat.example.org")
|
||||||
assert config.mailname == "chat.example.org"
|
assert config.mail_domain == "chat.example.org"
|
||||||
assert not config.privacy_supervisor and not config.privacy_mail
|
assert not config.privacy_supervisor and not config.privacy_mail
|
||||||
assert not config.privacy_pdo and not config.privacy_postal
|
assert not config.privacy_pdo and not config.privacy_postal
|
||||||
|
|
||||||
@@ -11,12 +11,12 @@ def test_read_config_basic(make_config):
|
|||||||
inipath.write_text(inipath.read_text().replace("60", "37"))
|
inipath.write_text(inipath.read_text().replace("60", "37"))
|
||||||
config = read_config(inipath)
|
config = read_config(inipath)
|
||||||
assert config.max_user_send_per_minute == 37
|
assert config.max_user_send_per_minute == 37
|
||||||
assert config.mailname == "chat.example.org"
|
assert config.mail_domain == "chat.example.org"
|
||||||
|
|
||||||
|
|
||||||
def test_read_config_testrun(make_config):
|
def test_read_config_testrun(make_config):
|
||||||
config = make_config("something.testrun.org")
|
config = make_config("something.testrun.org")
|
||||||
assert config.mailname == "something.testrun.org"
|
assert config.mail_domain == "something.testrun.org"
|
||||||
assert len(config.privacy_postal.split("\n")) > 1
|
assert len(config.privacy_postal.split("\n")) > 1
|
||||||
assert len(config.privacy_supervisor.split("\n")) > 1
|
assert len(config.privacy_supervisor.split("\n")) > 1
|
||||||
assert len(config.privacy_pdo.split("\n")) > 1
|
assert len(config.privacy_pdo.split("\n")) > 1
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def test_create_newemail_dict():
|
|||||||
def test_print_new_account(capsys, monkeypatch, maildomain, tmpdir):
|
def test_print_new_account(capsys, monkeypatch, maildomain, tmpdir):
|
||||||
p = tmpdir.join("mailname")
|
p = tmpdir.join("mailname")
|
||||||
p.write(maildomain)
|
p.write(maildomain)
|
||||||
monkeypatch.setattr(chatmaild.newemail, "mailname_path", str(p))
|
monkeypatch.setattr(chatmaild.newemail, "mail_domain_path", str(p))
|
||||||
print_new_account()
|
print_new_account()
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
lines = out.split("\n")
|
lines = out.split("\n")
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ requires = ["setuptools>=68"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "deploy-chatmail"
|
name = "cmdeploy"
|
||||||
version = "0.1"
|
version = "0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pyinfra",
|
"pyinfra",
|
||||||
"pillow",
|
"pillow",
|
||||||
@@ -22,10 +22,11 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
cmdeploy = "deploy_chatmail.cmdeploy:main"
|
cmdeploy = "cmdeploy.cmdeploy:main"
|
||||||
|
|
||||||
[project.entry-points.pytest11]
|
[project.entry-points.pytest11]
|
||||||
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
||||||
|
"cmdeploy.testplugin" = "cmdeploy.tests.plugin"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "-v -ra --strict-markers"
|
addopts = "-v -ra --strict-markers"
|
||||||
@@ -195,7 +195,7 @@ def _install_mta_sts_daemon() -> bool:
|
|||||||
server.shell(
|
server.shell(
|
||||||
name="install postfix-mta-sts-resolver with pip",
|
name="install postfix-mta-sts-resolver with pip",
|
||||||
commands=[
|
commands=[
|
||||||
"python3 -m venv /usr/local/lib/postfix-mta-sts-resolver",
|
"python3 -m virtualenv /usr/local/lib/postfix-mta-sts-resolver",
|
||||||
"/usr/local/lib/postfix-mta-sts-resolver/bin/pip install postfix-mta-sts-resolver",
|
"/usr/local/lib/postfix-mta-sts-resolver/bin/pip install postfix-mta-sts-resolver",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -347,8 +347,8 @@ def _configure_nginx(domain: str, debug: bool = False) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def check_config(config):
|
def check_config(config):
|
||||||
mailname = config.mailname
|
mail_domain = config.mail_domain
|
||||||
if mailname != "testrun.org" and not mailname.endswith(".testrun.org"):
|
if mail_domain != "testrun.org" and not mail_domain.endswith(".testrun.org"):
|
||||||
blocked_words = "merlinux schmieder testrun.org".split()
|
blocked_words = "merlinux schmieder testrun.org".split()
|
||||||
for value in config.__dict__.values():
|
for value in config.__dict__.values():
|
||||||
if any(x in value for x in blocked_words):
|
if any(x in value for x in blocked_words):
|
||||||
@@ -52,17 +52,17 @@ def run_cmd(args, out):
|
|||||||
"""Deploy chatmail services on the remote server."""
|
"""Deploy chatmail services on the remote server."""
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["CHATMAIL_DOMAIN"] = args.config.mailname
|
env["CHATMAIL_DOMAIN"] = args.config.mail_domain
|
||||||
deploypy = "deploy-chatmail/src/deploy_chatmail/deploy.py"
|
deploy_path = "cmdeploy/src/cmdeploy/deploy.py"
|
||||||
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
|
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
|
||||||
cmd = f"{pyinf} --ssh-user root {args.config.mailname} {deploypy}"
|
cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploy_path}"
|
||||||
out.check_call(cmd, env=env)
|
out.check_call(cmd, env=env)
|
||||||
|
|
||||||
|
|
||||||
def dns_cmd(args, out):
|
def dns_cmd(args, out):
|
||||||
"""Generate dns zone file."""
|
"""Generate dns zone file."""
|
||||||
template = importlib.resources.files(__package__).joinpath("chatmail.zone.f")
|
template = importlib.resources.files(__package__).joinpath("chatmail.zone.f")
|
||||||
ssh = f"ssh root@{args.config.mailname}"
|
ssh = f"ssh root@{args.config.mail_domain}"
|
||||||
|
|
||||||
def read_dkim_entries(entry):
|
def read_dkim_entries(entry):
|
||||||
lines = []
|
lines = []
|
||||||
@@ -77,16 +77,16 @@ def dns_cmd(args, out):
|
|||||||
dkim_entry = read_dkim_entries(out.shell_output(f"{ssh} -- opendkim-genzone -F"))
|
dkim_entry = read_dkim_entries(out.shell_output(f"{ssh} -- opendkim-genzone -F"))
|
||||||
|
|
||||||
out(
|
out(
|
||||||
f"[writing {args.config.mailname} zone data (using space as separator) to stdout output]",
|
f"[writing {args.config.mail_domain} zone data (using space as separator) to stdout output]",
|
||||||
green=True,
|
green=True,
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
template.read_text()
|
template.read_text()
|
||||||
.format(
|
.format(
|
||||||
acme_account_url=acme_account_url,
|
acme_account_url=acme_account_url,
|
||||||
email=f"root@{args.config.mailname}",
|
email=f"root@{args.config.mail_domain}",
|
||||||
sts_id=datetime.datetime.now().strftime("%Y%m%d%H%M"),
|
sts_id=datetime.datetime.now().strftime("%Y%m%d%H%M"),
|
||||||
chatmail_domain=args.config.mailname,
|
chatmail_domain=args.config.mail_domain,
|
||||||
dkim_entry=dkim_entry,
|
dkim_entry=dkim_entry,
|
||||||
)
|
)
|
||||||
.strip()
|
.strip()
|
||||||
@@ -96,9 +96,9 @@ def dns_cmd(args, out):
|
|||||||
def status_cmd(args, out):
|
def status_cmd(args, out):
|
||||||
"""Display status for online chatmail instance."""
|
"""Display status for online chatmail instance."""
|
||||||
|
|
||||||
ssh = f"ssh root@{args.config.mailname}"
|
ssh = f"ssh root@{args.config.mail_domain}"
|
||||||
|
|
||||||
out.green(f"chatmail domain: {args.config.mailname}")
|
out.green(f"chatmail domain: {args.config.mail_domain}")
|
||||||
if args.config.privacy_mail:
|
if args.config.privacy_mail:
|
||||||
out.green("privacy settings: present")
|
out.green("privacy settings: present")
|
||||||
else:
|
else:
|
||||||
@@ -122,7 +122,7 @@ def test_cmd(args, out):
|
|||||||
|
|
||||||
pytest_path = shutil.which("pytest")
|
pytest_path = shutil.which("pytest")
|
||||||
ret = out.run_ret(
|
ret = out.run_ret(
|
||||||
[pytest_path, "tests/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
|
[pytest_path, "cmdeploy/src/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
|
||||||
)
|
)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@@ -147,11 +147,7 @@ def fmt_cmd_options(parser):
|
|||||||
def fmt_cmd(args, out):
|
def fmt_cmd(args, out):
|
||||||
"""Run formattting fixes (fuff and black) on all chatmail source code."""
|
"""Run formattting fixes (fuff and black) on all chatmail source code."""
|
||||||
|
|
||||||
chatmaild = importlib.resources.files("chatmaild")
|
sources = [str(importlib.resources.files(x)) for x in ("chatmaild", "cmdeploy")]
|
||||||
deploy_chatmail = importlib.resources.files("deploy_chatmail")
|
|
||||||
tests = deploy_chatmail.joinpath("../../../tests")
|
|
||||||
sources = list(str(x) for x in [chatmaild, deploy_chatmail, tests])
|
|
||||||
|
|
||||||
black_args = [shutil.which("black")]
|
black_args = [shutil.which("black")]
|
||||||
ruff_args = [shutil.which("ruff")]
|
ruff_args = [shutil.which("ruff")]
|
||||||
|
|
||||||
@@ -174,9 +170,10 @@ def fmt_cmd(args, out):
|
|||||||
|
|
||||||
def bench_cmd(args, out):
|
def bench_cmd(args, out):
|
||||||
"""Run benchmarks against an online chatmail instance."""
|
"""Run benchmarks against an online chatmail instance."""
|
||||||
pytest_path = shutil.which("pytest")
|
args = ["pytest", "--pyargs", "cmdeploy.tests.online.benchmark", "-vrx"]
|
||||||
benchmark = "tests/online/benchmark.py"
|
cmdstring = " ".join(args)
|
||||||
subprocess.check_call([pytest_path, benchmark, "-vrx"])
|
out.green(f"[$ {cmdstring}]")
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
|
|
||||||
def webdev_cmd(args, out):
|
def webdev_cmd(args, out):
|
||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import pyinfra
|
import pyinfra
|
||||||
from deploy_chatmail import deploy_chatmail
|
from cmdeploy import deploy_chatmail
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
myorigin = {{ config.mailname }}
|
myorigin = {{ config.mail_domain }}
|
||||||
|
|
||||||
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
|
||||||
biff = no
|
biff = no
|
||||||
@@ -16,8 +16,8 @@ readme_directory = no
|
|||||||
compatibility_level = 2
|
compatibility_level = 2
|
||||||
|
|
||||||
# TLS parameters
|
# TLS parameters
|
||||||
smtpd_tls_cert_file=/var/lib/acme/live/{{ config.mailname }}/fullchain
|
smtpd_tls_cert_file=/var/lib/acme/live/{{ config.mail_domain }}/fullchain
|
||||||
smtpd_tls_key_file=/var/lib/acme/live/{{ config.mailname }}/privkey
|
smtpd_tls_key_file=/var/lib/acme/live/{{ config.mail_domain }}/privkey
|
||||||
smtpd_tls_security_level=may
|
smtpd_tls_security_level=may
|
||||||
|
|
||||||
smtp_tls_CApath=/etc/ssl/certs
|
smtp_tls_CApath=/etc/ssl/certs
|
||||||
@@ -26,7 +26,7 @@ smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
|||||||
smtp_tls_policy_maps = socketmap:inet:127.0.0.1:8461:postfix
|
smtp_tls_policy_maps = socketmap:inet:127.0.0.1:8461:postfix
|
||||||
|
|
||||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||||
myhostname = {{ config.mailname }}
|
myhostname = {{ config.mail_domain }}
|
||||||
alias_maps = hash:/etc/aliases
|
alias_maps = hash:/etc/aliases
|
||||||
alias_database = hash:/etc/aliases
|
alias_database = hash:/etc/aliases
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ inet_interfaces = all
|
|||||||
inet_protocols = all
|
inet_protocols = all
|
||||||
|
|
||||||
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
||||||
virtual_mailbox_domains = {{ config.mailname }}
|
virtual_mailbox_domains = {{ config.mail_domain }}
|
||||||
|
|
||||||
smtpd_milters = unix:opendkim/opendkim.sock
|
smtpd_milters = unix:opendkim/opendkim.sock
|
||||||
non_smtpd_milters = $smtpd_milters
|
non_smtpd_milters = $smtpd_milters
|
||||||
0
cmdeploy/src/cmdeploy/tests/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/online/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/online/__init__.py
Normal file
@@ -1,4 +1,4 @@
|
|||||||
from deploy_chatmail.genqr import gen_qr_png_data
|
from cmdeploy.genqr import gen_qr_png_data
|
||||||
|
|
||||||
|
|
||||||
def test_gen_qr_png_data(maildomain):
|
def test_gen_qr_png_data(maildomain):
|
||||||
@@ -91,9 +91,9 @@ class TestEndToEndDeltaChat:
|
|||||||
|
|
||||||
lp.sec("setup encrypted comms between ac1 and ac2 on different instances")
|
lp.sec("setup encrypted comms between ac1 and ac2 on different instances")
|
||||||
qr = ac1.get_setup_contact_qr()
|
qr = ac1.get_setup_contact_qr()
|
||||||
ac2.qr_setup_contact(qr)
|
ch = ac2.qr_setup_contact(qr)
|
||||||
msg = ac2.wait_next_incoming_message()
|
assert ch.id >= 10
|
||||||
assert "verified" in msg.text
|
ac1._evtracker.wait_securejoin_inviter_progress(1000)
|
||||||
|
|
||||||
lp.sec("ac1 sends a message and ac2 marks it as seen")
|
lp.sec("ac1 sends a message and ac2 marks it as seen")
|
||||||
chat = ac1.create_chat(ac2)
|
chat = ac1.create_chat(ac2)
|
||||||
@@ -38,7 +38,7 @@ def pytest_runtest_setup(item):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def chatmail_config(pytestconfig):
|
def chatmail_config(pytestconfig):
|
||||||
current = basedir = Path()
|
current = basedir = Path().resolve()
|
||||||
while 1:
|
while 1:
|
||||||
path = current.joinpath("chatmail.ini").resolve()
|
path = current.joinpath("chatmail.ini").resolve()
|
||||||
if path.exists():
|
if path.exists():
|
||||||
@@ -52,7 +52,7 @@ def chatmail_config(pytestconfig):
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def maildomain(chatmail_config):
|
def maildomain(chatmail_config):
|
||||||
return chatmail_config.mailname
|
return chatmail_config.mail_domain
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from deploy_chatmail.cmdeploy import get_parser, main
|
from cmdeploy.cmdeploy import get_parser, main
|
||||||
from chatmaild.config import read_config
|
from chatmaild.config import read_config
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class TestCmdline:
|
|||||||
main(["init", "chat.example.org"])
|
main(["init", "chat.example.org"])
|
||||||
inipath = tmp_path.joinpath("chatmail.ini")
|
inipath = tmp_path.joinpath("chatmail.ini")
|
||||||
config = read_config(inipath)
|
config = read_config(inipath)
|
||||||
assert config.mailname == "chat.example.org"
|
assert config.mail_domain == "chat.example.org"
|
||||||
|
|
||||||
def test_init_not_overwrite(self):
|
def test_init_not_overwrite(self):
|
||||||
main(["init", "chat.example.org"])
|
main(["init", "chat.example.org"])
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import importlib.resources
|
import importlib.resources
|
||||||
|
|
||||||
from deploy_chatmail.www import build_webpages
|
from cmdeploy.www import build_webpages
|
||||||
|
|
||||||
|
|
||||||
def test_build_webpages(tmp_path, make_config):
|
def test_build_webpages(tmp_path, make_config):
|
||||||
pkgroot = importlib.resources.files("deploy_chatmail")
|
pkgroot = importlib.resources.files("cmdeploy")
|
||||||
src_dir = pkgroot.joinpath("../../../www/src").resolve()
|
src_dir = pkgroot.joinpath("../../../www/src").resolve()
|
||||||
assert src_dir.exists(), src_dir
|
assert src_dir.exists(), src_dir
|
||||||
config = make_config("chat.example.org")
|
config = make_config("chat.example.org")
|
||||||
@@ -37,7 +37,7 @@ def build_webpages(src_dir, build_dir, config):
|
|||||||
|
|
||||||
|
|
||||||
def _build_webpages(src_dir, build_dir, config):
|
def _build_webpages(src_dir, build_dir, config):
|
||||||
mail_domain = config.mailname
|
mail_domain = config.mail_domain
|
||||||
assert src_dir.exists(), src_dir
|
assert src_dir.exists(), src_dir
|
||||||
if not build_dir.exists():
|
if not build_dir.exists():
|
||||||
build_dir.mkdir()
|
build_dir.mkdir()
|
||||||
@@ -71,7 +71,7 @@ def main():
|
|||||||
inipath = reporoot.joinpath("chatmail.ini")
|
inipath = reporoot.joinpath("chatmail.ini")
|
||||||
config = read_config(inipath)
|
config = read_config(inipath)
|
||||||
config.webdev = True
|
config.webdev = True
|
||||||
assert config.mailname
|
assert config.mail_domain
|
||||||
www_path = reporoot.joinpath("www")
|
www_path = reporoot.joinpath("www")
|
||||||
src_path = www_path.joinpath("src")
|
src_path = www_path.joinpath("src")
|
||||||
stats = None
|
stats = None
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
set -e
|
set -e
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
||||||
venv/bin/pip install -e deploy-chatmail
|
|
||||||
venv/bin/pip install -e chatmaild
|
venv/bin/pip install -e chatmaild
|
||||||
|
venv/bin/pip install -e cmdeploy
|
||||||
|
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
echo activated 'venv' python virtualenv environment containing "cmdeploy" tool
|
echo activated 'venv' python virtualenv environment containing "cmdeploy" tool
|
||||||
|
|||||||
Reference in New Issue
Block a user