add http-server part 7.5
All checks were successful
ci / build (push) Successful in 1m20s

This commit is contained in:
Christopher Hase 2025-04-11 10:51:14 +02:00
parent fb7a448c29
commit 0676dd5698
2 changed files with 11 additions and 11 deletions

View file

@ -3,11 +3,11 @@ import * as fs from 'fs';
import * as nodemailer from 'nodemailer'; import * as nodemailer from 'nodemailer';
// Config for scheduling the next time the main process (sending of horoscope) is run // Config for scheduling the next time the main process (sending of horoscope) is run
interface Config { /*interface Config {
emailReceiver: string; emailReceiver: string;
mailHost: string; mailHost: string;
mailPort: number; mailPort: number;
} }*/
// Node structure for the Parse Tree (it's a degenerated tree with one or zero children per node) // Node structure for the Parse Tree (it's a degenerated tree with one or zero children per node)
interface Node { interface Node {
@ -16,7 +16,7 @@ interface Node {
value?: string; value?: string;
} }
var config : Config; //var config : Config;
//const nodemailer = require('nodemailer'); //const nodemailer = require('nodemailer');
@ -37,9 +37,9 @@ export function executeCommand(): void {
} }
//Load config once //Load config once
if (config == undefined) { /*if (config == undefined) {
config = loadConfig(); config = loadConfig();
} } */
console.log(`Send E-Mail`); console.log(`Send E-Mail`);
sendEmail(stdout); sendEmail(stdout);
@ -50,28 +50,28 @@ export function executeCommand(): void {
executeCommand(); executeCommand();
// Load the Configuration // Load the Configuration
function loadConfig(): Config { /*function loadConfig(): Config {
console.log(`Load Config`); console.log(`Load Config`);
const data = fs.readFileSync('config.json', 'utf-8'); const data = fs.readFileSync('config.json', 'utf-8');
return JSON.parse(data); return JSON.parse(data);
} }*/
// Send E-Mail // Send E-Mail
async function sendEmail(content: string) { async function sendEmail(content: string) {
// Create Transporter // Create Transporter
const transporter = nodemailer.createTransport({ const transporter = nodemailer.createTransport({
host: config.mailHost, host: "mailhog.mailhog.svc.cluster.local", //config.mailHost,
port: config.mailPort, port: 1025, //config.mailPort,
secure: false secure: false
}); });
try { try {
const info = await transporter.sendMail({ const info = await transporter.sendMail({
from: '"The Oracle" <the.oracle@holy.mountain>', from: '"The Oracle" <the.oracle@holy.mountain>',
to: config.emailReceiver, to: "test@mailhog.local", //config.emailReceiver,
subject: "Your Horoscope Is Ready", subject: "Your Horoscope Is Ready",
text: content, text: content,
html: html(content) html: html(content)

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Starte Backend im Hintergrund # Starte Backend im Hintergrund
node /app/dist/backend/server.js & node dist/backend/server.js &
# Starte Frontend # Starte Frontend
npx http-server dist/frontend -p 8080 --mime application/javascript=js npx http-server dist/frontend -p 8080 --mime application/javascript=js