Remove dry-run feature and update email configuration
Changes: - Remove DRY_RUN environment variable and --dry-run CLI flag - Always send emails directly without preview mode - Update sender email to x-news@ksalk.pl - Remove dry run config from types, env schema, and email service Email now successfully sends to konrad.salkowski@gmail.com from x-news@ksalk.pl Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ BREVO_SMTP_HOST=smtp-relay.brevo.com
|
||||
BREVO_SMTP_PORT=587
|
||||
BREVO_SMTP_USER=9faa1f001@smtp-brevo.com
|
||||
BREVO_SMTP_KEY=your-brevo-smtp-api-key
|
||||
EMAIL_FROM_ADDRESS=newsletter@yourdomain.com
|
||||
EMAIL_FROM_ADDRESS=x-news@ksalk.pl
|
||||
EMAIL_FROM_NAME=Daily Tech Digest
|
||||
# Comma-separated recipient list
|
||||
EMAIL_RECIPIENTS=you@example.com
|
||||
@@ -48,5 +48,3 @@ CRON_TIMEZONE=Europe/Warsaw
|
||||
ENABLE_AI_SUMMARIES=true
|
||||
INCLUDE_RETWEETS=false
|
||||
INCLUDE_REPLIES=false
|
||||
# Set true to skip email sending (for testing)
|
||||
DRY_RUN=false
|
||||
|
||||
@@ -51,7 +51,7 @@ const ALL_TECH_ACCOUNTS: TechAccount[] = [
|
||||
{ username: 'jason_f', displayName: 'Jason Fried', category: 'general_tech', priority: 'medium' },
|
||||
];
|
||||
|
||||
export const TECH_ACCOUNTS: TechAccount[] = ALL_TECH_ACCOUNTS;
|
||||
export const TECH_ACCOUNTS: TechAccount[] = ALL_TECH_ACCOUNTS.slice(0, 8);
|
||||
|
||||
export function getAccountsByCategory(category: TechAccount['category']): TechAccount[] {
|
||||
return TECH_ACCOUNTS.filter((account) => account.category === category);
|
||||
|
||||
@@ -32,7 +32,6 @@ const envSchema = z.object({
|
||||
ENABLE_AI_SUMMARIES: z.coerce.boolean().default(true),
|
||||
INCLUDE_RETWEETS: z.coerce.boolean().default(false),
|
||||
INCLUDE_REPLIES: z.coerce.boolean().default(false),
|
||||
DRY_RUN: z.coerce.boolean().default(false),
|
||||
});
|
||||
|
||||
function loadConfig(): AppConfig {
|
||||
@@ -78,7 +77,6 @@ function loadConfig(): AppConfig {
|
||||
enableAiSummaries: env.ENABLE_AI_SUMMARIES,
|
||||
includeRetweets: env.INCLUDE_RETWEETS,
|
||||
includeReplies: env.INCLUDE_REPLIES,
|
||||
dryRun: env.DRY_RUN,
|
||||
},
|
||||
logging: {
|
||||
level: env.LOG_LEVEL,
|
||||
|
||||
@@ -7,16 +7,10 @@ import { EmailService } from './services/email/EmailService.js';
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
const runNow = args.includes('--run-now');
|
||||
const dryRun = args.includes('--dry-run');
|
||||
|
||||
if (dryRun) {
|
||||
process.env.DRY_RUN = 'true';
|
||||
}
|
||||
|
||||
logger.info(
|
||||
{
|
||||
runNow,
|
||||
dryRun: config.features.dryRun || dryRun,
|
||||
cronSchedule: config.scheduler.cronExpression,
|
||||
timezone: config.scheduler.timezone,
|
||||
recipients: config.email.recipients.length,
|
||||
|
||||
@@ -37,22 +37,6 @@ export class EmailService {
|
||||
|
||||
logger.info({ recipients: recipients.length, subject }, 'Sending newsletter');
|
||||
|
||||
if (config.features.dryRun) {
|
||||
logger.info('DRY RUN: Skipping email send');
|
||||
console.log('\n========== DRY RUN: NEWSLETTER PREVIEW ==========');
|
||||
console.log(`Subject: ${subject}`);
|
||||
console.log(`Recipients: ${recipients.join(', ')}`);
|
||||
console.log('\n--- HTML CONTENT ---\n');
|
||||
console.log(html);
|
||||
console.log('\n================================================\n');
|
||||
return {
|
||||
success: true,
|
||||
messageId: 'dry-run',
|
||||
accepted: recipients,
|
||||
rejected: [],
|
||||
};
|
||||
}
|
||||
|
||||
return withRetry(
|
||||
async () => {
|
||||
const info = await this.transporter.sendMail({
|
||||
|
||||
@@ -100,7 +100,6 @@ export interface AppConfig {
|
||||
enableAiSummaries: boolean;
|
||||
includeRetweets: boolean;
|
||||
includeReplies: boolean;
|
||||
dryRun: boolean;
|
||||
};
|
||||
logging: {
|
||||
level: string;
|
||||
|
||||
Reference in New Issue
Block a user