mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 20:00:15 +01:00
refactor: migrate checkEmailConfig to TypeScript and update imports
This commit is contained in:
parent
ab4596206f
commit
550bf56077
8 changed files with 27 additions and 32 deletions
|
|
@ -5,28 +5,7 @@ const sendEmail = require('./sendEmail');
|
|||
const queue = require('./queue');
|
||||
const files = require('./files');
|
||||
|
||||
/**
|
||||
* Check if email configuration is set
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function checkEmailConfig() {
|
||||
// Check if Mailgun is configured
|
||||
const hasMailgunConfig =
|
||||
!!process.env.MAILGUN_API_KEY && !!process.env.MAILGUN_DOMAIN && !!process.env.EMAIL_FROM;
|
||||
|
||||
// Check if SMTP is configured
|
||||
const hasSMTPConfig =
|
||||
(!!process.env.EMAIL_SERVICE || !!process.env.EMAIL_HOST) &&
|
||||
!!process.env.EMAIL_USERNAME &&
|
||||
!!process.env.EMAIL_PASSWORD &&
|
||||
!!process.env.EMAIL_FROM;
|
||||
|
||||
// Return true if either Mailgun or SMTP is properly configured
|
||||
return hasMailgunConfig || hasSMTPConfig;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
checkEmailConfig,
|
||||
...handleText,
|
||||
countTokens,
|
||||
removePorts,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue