update
This commit is contained in:
@ -11,8 +11,8 @@ import { UnifiedDeliveryQueue, type IQueueOptions } from './mail/delivery/classe
|
||||
import { MultiModeDeliverySystem, type IMultiModeDeliveryOptions } from './mail/delivery/classes.delivery.system.js';
|
||||
import { UnifiedRateLimiter, type IHierarchicalRateLimits } from './mail/delivery/classes.unified.rate.limiter.js';
|
||||
import { logger } from './logger.js';
|
||||
// Import the MTA configuration helpers directly from mail/delivery
|
||||
import { configureMtaStorage, configureMtaService } from './mail/delivery/index.js';
|
||||
// Import the email configuration helpers directly from mail/delivery
|
||||
import { configureEmailStorage, configureEmailServer } from './mail/delivery/index.js';
|
||||
|
||||
export interface IDcRouterOptions {
|
||||
/**
|
||||
@ -51,6 +51,8 @@ export interface IDcRouterOptions {
|
||||
certPath?: string;
|
||||
/** Path to key file (if not using auto-provisioning) */
|
||||
keyPath?: string;
|
||||
/** Path to CA certificate file (for custom CAs) */
|
||||
caPath?: string;
|
||||
};
|
||||
|
||||
/** DNS server configuration */
|
||||
@ -120,9 +122,9 @@ export class DcRouter {
|
||||
await this.setupUnifiedEmailHandling();
|
||||
|
||||
// Apply custom email storage configuration if available
|
||||
if (this.platformServiceRef && this.options.emailPortConfig?.receivedEmailsPath) {
|
||||
if (this.unifiedEmailServer && this.options.emailPortConfig?.receivedEmailsPath) {
|
||||
logger.log('info', 'Applying custom email storage configuration');
|
||||
configureMtaStorage(this.platformServiceRef, this.options);
|
||||
configureEmailStorage(this.unifiedEmailServer, this.options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +165,7 @@ export class DcRouter {
|
||||
const emailRoutes = this.generateEmailRoutes(this.options.emailConfig);
|
||||
console.log(`Email Routes are:`)
|
||||
console.log(emailRoutes)
|
||||
routes = [...routes, /* ...emailRoutes */];
|
||||
routes = [...routes, ...emailRoutes]; // Enable email routing through SmartProxy
|
||||
}
|
||||
|
||||
// Merge TLS/ACME configuration if provided at root level
|
||||
@ -704,14 +706,21 @@ export class DcRouter {
|
||||
logger.log('info', `Updated MTA port mappings: ${JSON.stringify(this.options.emailPortConfig.portMapping)}`);
|
||||
}
|
||||
|
||||
// Use the dedicated helper to configure the MTA service
|
||||
// Pass through the port specified by the implementation
|
||||
configureMtaService(this.platformServiceRef, {
|
||||
port: config.internalPort, // Use whatever port the implementation specifies
|
||||
host: config.host,
|
||||
secure: config.secure,
|
||||
storagePath: config.storagePath
|
||||
});
|
||||
// Use the dedicated helper to configure the email server
|
||||
// Pass through the options specified by the implementation
|
||||
if (this.unifiedEmailServer) {
|
||||
configureEmailServer(this.unifiedEmailServer, {
|
||||
ports: [config.internalPort], // Use whatever port the implementation specifies
|
||||
hostname: config.host,
|
||||
tls: config.secure ? {
|
||||
// Basic TLS settings if secure mode is enabled
|
||||
certPath: this.options.tls?.certPath,
|
||||
keyPath: this.options.tls?.keyPath,
|
||||
caPath: this.options.tls?.caPath
|
||||
} : undefined,
|
||||
storagePath: config.storagePath
|
||||
});
|
||||
}
|
||||
|
||||
// If email handling is already set up, restart it to apply changes
|
||||
if (this.unifiedEmailServer) {
|
||||
|
Reference in New Issue
Block a user