From 0676dd5698bd74be9e9ef29e0bd75912074d7077 Mon Sep 17 00:00:00 2001 From: Christopher Hase Date: Fri, 11 Apr 2025 10:51:14 +0200 Subject: [PATCH] add http-server part 7.5 --- backend/broker.ts | 20 ++++++++++---------- start.sh | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/broker.ts b/backend/broker.ts index 771cf47..99b0845 100644 --- a/backend/broker.ts +++ b/backend/broker.ts @@ -3,11 +3,11 @@ import * as fs from 'fs'; import * as nodemailer from 'nodemailer'; // Config for scheduling the next time the main process (sending of horoscope) is run -interface Config { +/*interface Config { emailReceiver: string; mailHost: string; mailPort: number; -} +}*/ // Node structure for the Parse Tree (it's a degenerated tree with one or zero children per node) interface Node { @@ -16,7 +16,7 @@ interface Node { value?: string; } -var config : Config; +//var config : Config; //const nodemailer = require('nodemailer'); @@ -37,9 +37,9 @@ export function executeCommand(): void { } //Load config once - if (config == undefined) { + /*if (config == undefined) { config = loadConfig(); - } + } */ console.log(`Send E-Mail`); sendEmail(stdout); @@ -50,28 +50,28 @@ export function executeCommand(): void { executeCommand(); // Load the Configuration -function loadConfig(): Config { +/*function loadConfig(): Config { console.log(`Load Config`); const data = fs.readFileSync('config.json', 'utf-8'); return JSON.parse(data); -} +}*/ // Send E-Mail async function sendEmail(content: string) { // Create Transporter const transporter = nodemailer.createTransport({ - host: config.mailHost, - port: config.mailPort, + host: "mailhog.mailhog.svc.cluster.local", //config.mailHost, + port: 1025, //config.mailPort, secure: false }); try { const info = await transporter.sendMail({ from: '"The Oracle" ', - to: config.emailReceiver, + to: "test@mailhog.local", //config.emailReceiver, subject: "Your Horoscope Is Ready", text: content, html: html(content) diff --git a/start.sh b/start.sh index d82f79a..5bd33bd 100644 --- a/start.sh +++ b/start.sh @@ -1,6 +1,6 @@ #!/bin/bash # Starte Backend im Hintergrund -node /app/dist/backend/server.js & +node dist/backend/server.js & # Starte Frontend npx http-server dist/frontend -p 8080 --mime application/javascript=js \ No newline at end of file