Skip to content

Commit

Permalink
Merge pull request #71 from JarvusInnovations/develop
Browse files Browse the repository at this point in the history
Release: emergence v1.1.4
  • Loading branch information
themightychris authored Oct 22, 2019
2 parents 76abe21 + 33aef4b commit bb52ba7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bin/fire-event
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ require('yargs')
})
}, argv => {
var path = require('path'),
kernelConfig = require('/emergence/config.json'),
socketPath = kernelConfig.services.plugins.php.socketPath || '/emergence/services/run/php-fpm/php-fpm.sock',
socketHostMatch = socketPath.match(/^(?<host>[^\/:]+):(?<port>\d+)$/),
documentRoot = path.resolve(__dirname, '../php-bootstrap'),
PHPFPM = require('node-phpfpm'),
phpClient = new PHPFPM({
sockFile: '/emergence/services/run/php-fpm/php-fpm.sock',
phpClientConfig = {
documentRoot: documentRoot + '/'
}),
},
payload = Object.assign({}, argv);

if (socketHostMatch) {
phpClientConfig.host = socketHostMatch.groups.host;
phpClientConfig.port = socketHostMatch.groups.port;
} else {
phpClientConfig.sockFile = socketPath;
}

delete payload._;
delete payload.help;
delete payload.version;
Expand All @@ -32,7 +41,7 @@ require('yargs')
delete payload['$0'];

// execute event via PHP-FPM interface
phpClient.run({
new PHPFPM(phpClientConfig).run({
uri: 'event.php',
json: {
site: argv.site,
Expand Down

0 comments on commit bb52ba7

Please sign in to comment.