small adjustments #1

Merged
lauri merged 3 commits from dev into master 2023-08-04 05:54:15 +00:00
3 changed files with 31 additions and 8 deletions

View File

@ -12,6 +12,7 @@
"wildDuck": {
"url": "http://localhost",
"token": "aaaaa",
"domain": "test-codemowers.eu"
"domain": "test-codemowers.eu",
"preferredDomain": "k-space.ee"
}
}

View File

@ -3,11 +3,31 @@ import { logger } from "./logger";
const port = app.get("port");
const host = app.get("host");
process.on("unhandledRejection", (reason) =>
logger.error("Unhandled Rejection %O", reason),
);
const server = app.listen(port);
app.listen(port).then(() => {
logger.info(`Feathers app listening on http://${host}:${port}`);
logger.info(`Walias app listening on http://${host}:${port}`);
});
process.on("SIGINT", () => {
logger.info("Received SIGINT signal. Shutting down gracefully.");
server.close(() => {
logger.info("HTTP server closed.");
process.exit(0);
});
});
process.on("SIGTERM", () => {
logger.info("Received SIGTERM signal. Shutting down gracefully.");
server.close(() => {
logger.info("HTTP server closed.");
process.exit(0);
});
});
process.on("unhandledRejection", (reason) => {
logger.error("Unhandled rejection", reason);
process.exit(1);
});

View File

@ -93,7 +93,9 @@ export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
const emails = params.session?.user?.emails;
const addressInfoResponse = await Promise.any(
emails.map((email: string) =>
emails
.filter((email: string) => email.endsWith(config.get("wildDuck.preferredDomain")))
.map((email: string) =>
wildDuckClient.get<Alias>(`addresses/resolve/${email}`),
),
);