ekyc

Electronic KYC process with uploading ID document using OAuth 2.1 (experimental)
Log | Files | Refs | README | LICENSE

mailer.ts (495B)


      1 import { createFakeMailer } from "#infrastructure/fake/mailer.ts";
      2 import { createSmtpMailer } from "#infrastructure/smtp/factory.ts";
      3 
      4 export type MailerDependencies = {
      5   environment: {
      6     MAILER: "fake" | "smtp";
      7   };
      8 } & Parameters<typeof createSmtpMailer>[0];
      9 
     10 export function createMailer(dependencies: MailerDependencies) {
     11   switch (dependencies.environment.MAILER) {
     12     case "fake":
     13       return createFakeMailer();
     14     case "smtp":
     15       return createSmtpMailer(dependencies);
     16   }
     17 }