diff --git a/CHANGELOG.md b/CHANGELOG.md
index cdab41f..0544e5f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
### Changelog
All notable changes to this project will be documented in this file.
+## [1.4.1] - 2019-03-07
+### Fixed
+- Email notification: logs attachment was missing on backup error
+
## [1.4.0] - 2019-03-06
### Fixed
- With multiple folders in the backup job the S3 paths were wrong
diff --git a/package-lock.json b/package-lock.json
index 6414c4e..95981aa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "aws-s3-backup",
- "version": "1.3.0",
+ "version": "1.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -7355,56 +7355,15 @@
}
},
"jszip": {
- "version": "3.1.5",
- "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz",
- "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.2.0.tgz",
+ "integrity": "sha512-4WjbsaEtBK/DHeDZOPiPw5nzSGLDEDDreFRDEgnoMwmknPjTqa+23XuYFk6NiGbeiAeZCctiQ/X/z0lQBmDVOQ==",
"dev": true,
"requires": {
- "core-js": "~2.3.0",
- "es6-promise": "~3.0.2",
- "lie": "~3.1.0",
+ "lie": "~3.3.0",
"pako": "~1.0.2",
- "readable-stream": "~2.0.6"
- },
- "dependencies": {
- "core-js": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz",
- "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=",
- "dev": true
- },
- "es6-promise": {
- "version": "3.0.2",
- "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz",
- "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=",
- "dev": true
- },
- "process-nextick-args": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
- "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
- "dev": true
- },
- "readable-stream": {
- "version": "2.0.6",
- "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
- "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=",
- "dev": true,
- "requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.1",
- "isarray": "~1.0.0",
- "process-nextick-args": "~1.0.6",
- "string_decoder": "~0.10.x",
- "util-deprecate": "~1.0.1"
- }
- },
- "string_decoder": {
- "version": "0.10.31",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
- "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
- "dev": true
- }
+ "readable-stream": "~2.3.6",
+ "set-immediate-shim": "~1.0.1"
}
},
"karma": {
@@ -7784,9 +7743,9 @@
}
},
"lie": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
- "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
+ "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"dev": true,
"requires": {
"immediate": "~3.0.5"
@@ -15099,6 +15058,12 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true
},
+ "set-immediate-shim": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
+ "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=",
+ "dev": true
+ },
"set-value": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
diff --git a/package.json b/package.json
index b2e49c7..b253d87 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "aws-s3-backup",
- "version": "1.4.0",
+ "version": "1.4.1",
"description": "AWS S3 backup system",
"homepage": "https://github.com/ulver2812/aws-s3-backup",
"author": {
diff --git a/src/app/providers/aws.service.ts b/src/app/providers/aws.service.ts
index 634f1a9..3889d6f 100644
--- a/src/app/providers/aws.service.ts
+++ b/src/app/providers/aws.service.ts
@@ -160,7 +160,7 @@ export class AwsService {
this.jobService.save(job);
this.logService.printLog(LogType.ERROR, 'Can\'t run job ' + job.name + ' because of: \r\n' + err);
this.notification.sendNotification('Problem with job: ' + job.name, 'The job ' + job.name +
- ' has just stopped because of ' + err + '.
- AWS S3 Backup', 'email');
+ ' has just stopped because of ' + err + '.
- AWS S3 Backup', 'email', true);
if (err) {
return callback(err);
}
@@ -178,7 +178,7 @@ export class AwsService {
this.jobService.save(job);
this.logService.printLog(LogType.ERROR, 'Error with job ' + job.name + ' because of: \r\n' + err);
this.notification.sendNotification('Problem with job: ' + job.name, 'The job ' + job.name +
- ' has just throw an error because of ' + err + '.
- AWS S3 Backup', 'email');
+ ' has just throw an error because of ' + err + '.
- AWS S3 Backup', 'email', true);
});
} else {
diff --git a/src/app/providers/log.service.ts b/src/app/providers/log.service.ts
index 53accb4..1cc72a8 100644
--- a/src/app/providers/log.service.ts
+++ b/src/app/providers/log.service.ts
@@ -44,4 +44,8 @@ export class LogService {
fs.ensureFileSync(this.logFile);
return fs.readFileSync(this.logFile, {encoding: 'utf8'});
}
+
+ getLogsFile() {
+ return this.logFile;
+ }
}
diff --git a/src/app/providers/notifications.service.ts b/src/app/providers/notifications.service.ts
index 71d736b..2b7958e 100644
--- a/src/app/providers/notifications.service.ts
+++ b/src/app/providers/notifications.service.ts
@@ -34,7 +34,7 @@ export class NotificationsService {
}
// subject = await this.translate.get('NOTIFICATIONS.SUBJECT-START').toPromise();
- sendNotification(subject: string, message: string, channel: string) {
+ sendNotification(subject: string, message: string, channel: string, logAttachment: boolean = false) {
const settings = this.settingsService.getSettings();
if (settings.allowNotifications === false) {
return;
@@ -42,19 +42,31 @@ export class NotificationsService {
if (channel === 'email') {
const transporter = this.getEmailTransporter();
- transporter.sendMail(this.getMailOptions(subject, message), (err: Error, res: Response) => {
+ transporter.sendMail(this.getMailOptions(subject, message, logAttachment), (err: Error, res: Response) => {
this.log.printLog(LogType.ERROR, 'Email - ' + err.message);
});
}
}
- getMailOptions(subject: string, message: string) {
+ getMailOptions(subject: string, message: string, logAttachment: boolean = false) {
const settings = this.settingsService.getSettings();
- return {
+
+ const options = {
from: settings.emailSender, // sender address
to: settings.emailReceivers, // list of receivers
subject: subject, // Subject line
- html: message // html body
+ html: message, // html body
};
+
+ if (logAttachment) {
+ options['attachments'] = [
+ {
+ filename: 'log-activities.txt',
+ path: this.log.getLogsFile() // stream this file
+ }
+ ];
+ }
+
+ return options;
}
}