Fix mail settings and add mail from
This commit is contained in:
parent
b043513fe8
commit
ca39c3e538
@ -1,7 +1,7 @@
|
|||||||
export default {
|
export default {
|
||||||
app: {
|
app: {
|
||||||
name: 'Example App',
|
name: 'Example App',
|
||||||
contact_email: 'noreply@example.net'
|
contact_email: 'contact@example.net'
|
||||||
},
|
},
|
||||||
log_level: "DEV",
|
log_level: "DEV",
|
||||||
db_log_level: "ERROR",
|
db_log_level: "ERROR",
|
||||||
@ -34,7 +34,9 @@ export default {
|
|||||||
secure: false,
|
secure: false,
|
||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
allow_invalid_tls: true
|
allow_invalid_tls: true,
|
||||||
|
from: 'contact@example.net',
|
||||||
|
from_name: 'Example App',
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
cache: false
|
cache: false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wms-core",
|
"name": "wms-core",
|
||||||
"version": "0.10.16",
|
"version": "0.10.18",
|
||||||
"description": "Node web framework",
|
"description": "Node web framework",
|
||||||
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
|
||||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||||
|
@ -93,11 +93,16 @@ export default class Mail {
|
|||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
this.options.to = destEmail;
|
this.options.to = destEmail;
|
||||||
|
this.options.from = {
|
||||||
|
name: config.get('mail.from_name'),
|
||||||
|
address: config.get('mail.from'),
|
||||||
|
};
|
||||||
|
|
||||||
// Set data
|
// Set data
|
||||||
this.data.mail_subject = this.options.subject;
|
this.data.mail_subject = this.options.subject;
|
||||||
this.data.mail_to = this.options.to;
|
this.data.mail_to = this.options.to;
|
||||||
this.data.mail_link = `${config.get<string>('public_url')}${mailRoute(this.template.template)}?${querystring.stringify(this.data)}`;
|
this.data.mail_link = `${config.get<string>('public_url')}${mailRoute(this.template.template)}?${querystring.stringify(this.data)}`;
|
||||||
|
this.data.app = config.get('app');
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
Logger.dev('Send mail', this.options);
|
Logger.dev('Send mail', this.options);
|
||||||
@ -128,7 +133,7 @@ export class MailTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getSubject(data: any): string {
|
public getSubject(data: any): string {
|
||||||
return 'Watch My Stream - ' + this.subject(data);
|
return `${config.get('app.name')} - ${this.subject(data)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import ApplicationComponent from "../ApplicationComponent";
|
|||||||
import {Express, NextFunction, Request, Response, Router} from "express";
|
import {Express, NextFunction, Request, Response, Router} from "express";
|
||||||
import {ServiceUnavailableHttpError} from "../HttpError";
|
import {ServiceUnavailableHttpError} from "../HttpError";
|
||||||
import Application from "../Application";
|
import Application from "../Application";
|
||||||
|
import config from "config";
|
||||||
|
|
||||||
export default class MaintenanceComponent extends ApplicationComponent<void> {
|
export default class MaintenanceComponent extends ApplicationComponent<void> {
|
||||||
private readonly application: Application;
|
private readonly application: Application;
|
||||||
@ -22,12 +23,12 @@ export default class MaintenanceComponent extends ApplicationComponent<void> {
|
|||||||
if (!this.application.isReady()) {
|
if (!this.application.isReady()) {
|
||||||
res.header({'Retry-After': 60});
|
res.header({'Retry-After': 60});
|
||||||
res.locals.refresh_after = 5;
|
res.locals.refresh_after = 5;
|
||||||
throw new ServiceUnavailableHttpError('Watch My Stream is readying up. Please wait a few seconds...');
|
throw new ServiceUnavailableHttpError(`${config.get('app.name')} is readying up. Please wait a few seconds...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.canServe()) {
|
if (!this.canServe()) {
|
||||||
res.locals.refresh_after = 30;
|
res.locals.refresh_after = 30;
|
||||||
throw new ServiceUnavailableHttpError('Watch My Stream is unavailable due to failure of dependent services.');
|
throw new ServiceUnavailableHttpError(`${config.get('app.name')} is unavailable due to failure of dependent services.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
Loading…
Reference in New Issue
Block a user