Add schema + Plugin use now an array of receivers

This commit is contained in:
wescoeur 2015-11-25 16:36:08 +01:00
parent 7e04f26f78
commit 8cfc6f0b1d

View File

@ -1,14 +1,29 @@
import forEach from 'lodash.foreach'
import moment from 'moment'
export const configurationSchema = {
type: 'object',
properties: {
to: {
type: 'array',
items: {
type: 'string'
},
minItems: 1
}
}
}
// ===================================================================
class BackupReportsXoPlugin {
constructor (xo) {
this._xo = xo
this._report = ::this._wrapper
}
configure (conf) {
this._conf = conf
configure ({to}) {
this._receivers = to
}
load () {
@ -96,7 +111,7 @@ class BackupReportsXoPlugin {
// TODO : Handle errors when `sendEmail` isn't present. (Plugin dependencies)
this._xo.sendEmail({
to: 'ronan.abhamon@gmail.com', // FIXME
to: this._receivers,
subject: 'Backup Reports (XenOrchestra)',
markdown: text.join('\n')
}).catch(e => console.error('Unable to send email: ', e))