aboutsummaryrefslogtreecommitdiff
path: root/services/docker/mail-server/relay/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'services/docker/mail-server/relay/app.ts')
-rw-r--r--services/docker/mail-server/relay/app.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/services/docker/mail-server/relay/app.ts b/services/docker/mail-server/relay/app.ts
index 3a85996..87a4d77 100644
--- a/services/docker/mail-server/relay/app.ts
+++ b/services/docker/mail-server/relay/app.ts
@@ -2,12 +2,12 @@ import { join } from "@std/path";
import { Hono } from "hono";
import { logger as honoLogger } from "hono/logger";
-import logger, { error } from "./logger.ts";
+import log from "./log.ts";
import config from "./config.ts";
import { DbService } from "./db.ts";
import {
- AliasFileMailHook,
- FallbackReceiptsHook,
+ AliasRecipientMailHook,
+ FallbackRecipientHook,
MailDeliverer,
} from "./mail.ts";
import { DovecotMailDeliverer } from "./dovecot.ts";
@@ -24,21 +24,21 @@ export abstract class AppBase {
protected abstract readonly outboundDeliverer: MailDeliverer;
constructor() {
- const dataPath = config.getValue("dataPath");
+ const dataPath = config.get("dataPath");
Deno.mkdirSync(dataPath, { recursive: true });
- logger.path = join(dataPath, "log");
- logger.log(config);
+ log.path = join(dataPath, "log");
+ log.info(config);
this.db = new DbService(join(dataPath, "db.sqlite"));
this.inboundDeliverer = new DovecotMailDeliverer();
this.inboundDeliverer.preHooks.push(
- new FallbackReceiptsHook(new Set(config.getValueList("inboundFallback"))),
- new AliasFileMailHook(join(dataPath, "aliases.csv")),
+ new FallbackRecipientHook(new Set(config.getList("inboundFallback"))),
+ new AliasRecipientMailHook(join(dataPath, "aliases.csv")),
);
this.hono.onError((err, c) => {
- error(err);
- return c.json({ msg: "Server error." }, 500);
+ log.error(err);
+ return c.json({ msg: "Server error, check its log." }, 500);
});
this.hono.use(honoLogger());
@@ -56,7 +56,7 @@ export abstract class AppBase {
});
this.hono.post("/receive/raw", async (context) => {
await this.inboundDeliverer.deliverRaw(await context.req.text());
- return context.json({});
+ return context.json({ "msg": "Done!" });
});
}