don't overwrite the event.data.event if it exists already

This commit is contained in:
Egor Kislitsyn 2016-04-14 21:06:04 +07:00
parent 6cd6dd7b2d
commit a6a2f164af

View File

@ -119,6 +119,9 @@ module.exports = function(S) {
// Missing function
if (!this.function) return BbPromise.reject(new SError(`Function ${this.evt.options.name} does not exist in your project.`));
// load event data if not it not present already
if (this.evt.data.event) return BbPromise.resolve();
return this._getEventFromStdIn()
.then(event => event || S.utils.readFile(this.function.getRootPath('event.json')))
.then(event => this.evt.data.event = event);