1- type Env = {
1+ export type Env = {
22 DATABASE_URL : string ;
33 PORT : number ;
44 BETTER_AUTH_SECRET : string ;
@@ -12,9 +12,16 @@ type Env = {
1212 S3_BUCKET_RULES : string ;
1313 S3_BUCKET_SUBMISSIONS : string ;
1414 S3_FORCE_PATH_STYLE : boolean ;
15- EMAIL_PROVIDER : 'console' | 'sendgrid' ;
15+ EMAIL_PROVIDER : 'console' | 'sendgrid' | 'smtp' ;
1616 SENDGRID_API_KEY ?: string ;
1717 SENDGRID_FROM : string ;
18+ SMTP_HOST ?: string ;
19+ SMTP_PORT : number ;
20+ SMTP_USER ?: string ;
21+ SMTP_PASS ?: string ;
22+ SMTP_FROM ?: string ;
23+ SMTP_SECURE : boolean ;
24+ SMTP_REQUIRE_TLS : boolean ;
1825} ;
1926
2027const toBool = ( value : string | undefined , fallback : boolean ) : boolean => {
@@ -51,7 +58,17 @@ export const env: Env = {
5158 S3_BUCKET_RULES : process . env . S3_BUCKET_RULES ?? 'robocon-rules' ,
5259 S3_BUCKET_SUBMISSIONS : process . env . S3_BUCKET_SUBMISSIONS ?? 'robocon-submissions' ,
5360 S3_FORCE_PATH_STYLE : toBool ( process . env . S3_FORCE_PATH_STYLE , true ) ,
54- EMAIL_PROVIDER : process . env . EMAIL_PROVIDER === 'sendgrid' ? 'sendgrid' : 'console' ,
61+ EMAIL_PROVIDER :
62+ process . env . EMAIL_PROVIDER === 'sendgrid' || process . env . EMAIL_PROVIDER === 'smtp'
63+ ? process . env . EMAIL_PROVIDER
64+ : 'console' ,
5565 SENDGRID_API_KEY : process . env . SENDGRID_API_KEY ,
5666 SENDGRID_FROM : process . env . SENDGRID_FROM ?? 'noreply@example.com' ,
67+ SMTP_HOST : process . env . SMTP_HOST ,
68+ SMTP_PORT : Number ( process . env . SMTP_PORT ?? 587 ) ,
69+ SMTP_USER : process . env . SMTP_USER ,
70+ SMTP_PASS : process . env . SMTP_PASS ,
71+ SMTP_FROM : process . env . SMTP_FROM ,
72+ SMTP_SECURE : toBool ( process . env . SMTP_SECURE , false ) ,
73+ SMTP_REQUIRE_TLS : toBool ( process . env . SMTP_REQUIRE_TLS , false ) ,
5774} ;
0 commit comments