Skip to content

Commit

Permalink
Make beanstalkd IP and port configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
markkimsal committed Feb 17, 2017
1 parent 0284dd8 commit 1e72d4b
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions bin/beanstalk_listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@
'p'
],
'default' => ''
],
[
'name' => 'beanstalkdIp',
'keys' => [
'ip',
'i'
],
'default' => '127.0.0.1'
],
[
'name' => 'beanstalkdPort',
'keys' => [
'port',
'o'
],
'default' => '11300'

]
];
$h = getenv('HOME');
Expand All @@ -66,9 +83,11 @@
'convid:',
'refresh-token:',
'watch:',
'ip:',
'port:',
];

$options = getopt('c:w:r:', $o);
$options = getopt('c:w:r:i:o:', $o);
$config = array_merge($defaults);

foreach ($argDefs as $arg) {
Expand Down Expand Up @@ -123,7 +142,7 @@

Amp\run(function () use ($config, $hwpclient) {
try {
$client = new Amp\Beanstalk\BeanstalkClient('127.0.0.1:11300');
$client = new Amp\Beanstalk\BeanstalkClient($config['beanstalkdIp'].':'.$config['beanstalkdPort']);

$client->watch($config['watch']);

Expand Down Expand Up @@ -207,6 +226,10 @@ function helpText() {
echo " (defaults to 'hangouts')\n";
echo " -c --convid: The unique conversation ID\n";
echo " -r --refresh-token: The filename to use as refresh token cache.\n";
echo " -i --ip: The IP address of the beanstalkd server\n";
echo " (defaults to '127.0.0.1')\n";
echo " -o --port: The port number of the beanstalkd server\n";
echo " (defaults to '11300')\n";
echo " -e --email: Email for sign-in.\n";
echo " (only required one time if --refresh-token is used)\n";
echo " (Using email and password is strongly discouraged\n";
Expand Down

0 comments on commit 1e72d4b

Please sign in to comment.