From 856068d61fe4397573d1834cbc423f0e66ccf285 Mon Sep 17 00:00:00 2001 From: Pavel Dmitriev Date: Sun, 22 Jan 2023 11:18:02 +0300 Subject: [PATCH] fix --- .drone.yml | 2 -- barcodeScanner.php | 16 +++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index ac1363a..97cad6c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -71,8 +71,6 @@ steps: find . -name ".travis*" -prune -exec rm -rf '{}' \; find . -name "installed.json" -prune -exec rm -rf '{}' \; find . -name "*.sample" -prune -exec rm -rf '{}' \; - find . -type d ! -path './.git/**' ! -path './static/**' ! -path "./static" ! -path ./*/modules/*/static* -exec bash -c 'test -f {}/.htaccess && echo -n "[ SKIP ] " || (cp ./docker-build/.htaccess {} && echo -n "[ ADD ] ") && echo {}/.htaccess' \; - cp docker-build/Dockerfile Dockerfile rm -f composer.* - name: Build docker image diff --git a/barcodeScanner.php b/barcodeScanner.php index b6a730a..5ce8ee1 100644 --- a/barcodeScanner.php +++ b/barcodeScanner.php @@ -8,12 +8,14 @@ use PhpAmqpLib\Message\AMQPMessage; $lineReadTimeout=1; -$port=getenv("SCANNER_PORT");// "/dev/ttyACM0"; -$rabbitHost=getenv("RABBITMQ_HOST"); // "rabbitmq"; +$port=getenv("SCANNER_PORT"); +$rabbitHost=getenv("RABBITMQ_HOST"); $rabbitPort=getenv("RABBITMQ_PORT")?getenv("RABBITMQ_PORT"):5672; -$rabbitLogin=getenv("RABBITMQ_USER");//'guest'; -$rabbitPass=getenv("RABBITMQ_PASSWORD"); //'guest'; -$rabbitUseSSL=getenv("RABBITMQ_USE_SSL")==="true"; // false; +$rabbitLogin=getenv("RABBITMQ_USER"); +$rabbitPass=getenv("RABBITMQ_PASSWORD"); +$rabbitUseSSL=getenv("RABBITMQ_USE_SSL")==="true"; +$rabbitVirtualHost=getenv("RABBITMQ_VIRTUAL_HOST")?getenv("RABBITMQ_VIRTUAL_HOST"):"/"; + $routingTag=null; $connection=null; @@ -45,9 +47,9 @@ function rabbitConnect($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rab 'allow_self_signed' => false ]; - $connection = new AMQPSSLConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass,'/',$ssl_opts); + $connection = new AMQPSSLConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass,$rabbitVirtualHost,$ssl_opts); } else { - $connection = new AMQPStreamConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass); + $connection = new AMQPStreamConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass,$rabbitVirtualHost); } return $connection; }