Add schema + Plugin use now an array of receivers
This commit is contained in:
parent
7e04f26f78
commit
8cfc6f0b1d
@ -1,14 +1,29 @@
|
|||||||
import forEach from 'lodash.foreach'
|
import forEach from 'lodash.foreach'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
|
export const configurationSchema = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
to: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
minItems: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
|
||||||
class BackupReportsXoPlugin {
|
class BackupReportsXoPlugin {
|
||||||
constructor (xo) {
|
constructor (xo) {
|
||||||
this._xo = xo
|
this._xo = xo
|
||||||
this._report = ::this._wrapper
|
this._report = ::this._wrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
configure (conf) {
|
configure ({to}) {
|
||||||
this._conf = conf
|
this._receivers = to
|
||||||
}
|
}
|
||||||
|
|
||||||
load () {
|
load () {
|
||||||
@ -96,7 +111,7 @@ class BackupReportsXoPlugin {
|
|||||||
|
|
||||||
// TODO : Handle errors when `sendEmail` isn't present. (Plugin dependencies)
|
// TODO : Handle errors when `sendEmail` isn't present. (Plugin dependencies)
|
||||||
this._xo.sendEmail({
|
this._xo.sendEmail({
|
||||||
to: 'ronan.abhamon@gmail.com', // FIXME
|
to: this._receivers,
|
||||||
subject: 'Backup Reports (XenOrchestra)',
|
subject: 'Backup Reports (XenOrchestra)',
|
||||||
markdown: text.join('\n')
|
markdown: text.join('\n')
|
||||||
}).catch(e => console.error('Unable to send email: ', e))
|
}).catch(e => console.error('Unable to send email: ', e))
|
||||||
|
Loading…
Reference in New Issue
Block a user