This commit is contained in:
parent
fb7a448c29
commit
0676dd5698
2 changed files with 11 additions and 11 deletions
|
@ -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" <the.oracle@holy.mountain>',
|
||||
to: config.emailReceiver,
|
||||
to: "test@mailhog.local", //config.emailReceiver,
|
||||
subject: "Your Horoscope Is Ready",
|
||||
text: content,
|
||||
html: html(content)
|
||||
|
|
2
start.sh
2
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
|
Loading…
Reference in a new issue