pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
7 changed files with 25 additions and 11 deletions
Showing only changes of commit fceee0b4ea - Show all commits

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "owlboard", "name": "owlboard",
"version": "0.0.1", "version": "1.2.0-dev",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "owlboard", "name": "owlboard",
"version": "0.0.1", "version": "1.2.0-dev",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"axios": "^1.2.1", "axios": "^1.2.1",

View File

@ -10,15 +10,16 @@
}, },
"name": "owlboard", "name": "owlboard",
"description": "OwlBoard is an API and PWA for live rail departure board in the UK.", "description": "OwlBoard is an API and PWA for live rail departure board in the UK.",
"version": "0.0.1", "version": "1.2.0-dev",
"main": "express.js", "main": "express.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js" "start": "node app.js",
"run": "node app.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.fjla.uk/fred.boniface/owlboard.git" "url": "https://git.fjla.uk/owlboard/backend.git"
}, },
"author": "Fred Boniface", "author": "Fred Boniface",
"license": "GPL-3.0-or-later" "license": "GPL-3.0-or-later"

View File

@ -1,3 +1,6 @@
const testing = require('../services/mail.services')
const log = require('../utils/log.utils')
async function getAlive(){ async function getAlive(){
log.out(`kubeServices.getAlive: alive hook checked`, "info") log.out(`kubeServices.getAlive: alive hook checked`, "info")
return {code: 200, state: {state: "alive",noise: "twit-twoo"}} return {code: 200, state: {state: "alive",noise: "twit-twoo"}}
@ -5,6 +8,7 @@ async function getAlive(){
async function getReady(){ async function getReady(){
log.out(`kubeServices.getReady: ready hook checked`, "info") log.out(`kubeServices.getReady: ready hook checked`, "info")
testing.sendTest("fred@fjla.uk");
return "not_implemented"; return "not_implemented";
}; };

View File

@ -1,5 +1,5 @@
const log = require('../utils/log.utils') const log = require('../utils/log.utils')
const fs = require('fs') const fs = require('fs/promises')
const mail = require('nodemailer'); //>> Probs wrong const mail = require('nodemailer'); //>> Probs wrong
const fromAdrr = process.env.OWL_EML_FROM const fromAdrr = process.env.OWL_EML_FROM
@ -21,16 +21,25 @@ const options = {
let transporter = mail.createTransport(options) let transporter = mail.createTransport(options)
async function sendTest(to, subject, html) { async function sendTest(to, cc, bcc) {
log.out(`mailServices.sendTest: Sending test message to: ${to}, subject: ${subject}`, "info") log.out(`mailServices.sendTest: Sending test message to: ${to}`, "info")
let tHtml = fs.readFile('mail-templates/test.html', 'utf-8');
let tTxt = fs.readFile('mail-templates/test.txt', 'ascii')
// Send test mail message // Send test mail message
let res = await transporter.sendMail({ try {
var res = await transporter.sendMail({
from: fromAdrr, from: fromAdrr,
to: to, to: to,
cc: cc,
bcc: bcc,
subject: "Test Message from OwlBoard", subject: "Test Message from OwlBoard",
text: "OwlBoard Test Message - See HTML", text: await tTxt,
html: html html: await tHtml
}); });
} catch(err) {
log.out(err, "warn")
var res = "failed"
}
return res; return res;
} }