From 1e72d4bcf65139327a8e7d665ef27b299831d22c Mon Sep 17 00:00:00 2001 From: Mark Kimsal Date: Fri, 17 Feb 2017 14:43:23 -0500 Subject: [PATCH] Make beanstalkd IP and port configurable --- bin/beanstalk_listener.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/bin/beanstalk_listener.php b/bin/beanstalk_listener.php index acb2bfa..a4a17a8 100755 --- a/bin/beanstalk_listener.php +++ b/bin/beanstalk_listener.php @@ -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'); @@ -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) { @@ -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']); @@ -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";