small adjustments #1

Merged
lauri merged 3 commits from dev into master 2023-08-04 05:54:15 +00:00
2 changed files with 30 additions and 7 deletions
Showing only changes of commit d5e92d075e - Show all commits

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

@ -47,7 +47,7 @@ export interface AliasesParams extends Params<AliasesQuery> {
export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
implements ServiceInterface<Alias, AliasesData, ServiceParams, AliasesPatch>
{
constructor(public options: AliasesServiceOptions) { }
constructor(public options: AliasesServiceOptions) {}
async find(params: ServiceParams): Promise<Alias[]> {
const userId = await this.getUserIdByEmailAddress(params);
@ -117,7 +117,10 @@ export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
const allowedDomain: string = config.get("wildDuck.domain");
// If address does not match the allowed domain, throw an error
if (!allowedDomain || !addressInfoResponse.address.endsWith(allowedDomain)) {
if (
!allowedDomain ||
!addressInfoResponse.address.endsWith(allowedDomain)
) {
throw new BadRequest("Unable to delete address");
}