From 304d2b6adfe46ce794e819c9e0951c28e0699a7f Mon Sep 17 00:00:00 2001 From: nixx Date: Wed, 25 Sep 2024 13:41:23 +0300 Subject: [PATCH] add env rabbit user & pass --- .github/workflows/publish.yml | 2 +- README.md | 4 +++- examples/run.php | 10 ++++++---- src/ClickhouseWorker.php | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6c4acc7..8f173c4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: jobs: push_to_registry: name: Push Docker image to Docker Hub - runs-on: [self-hosted] + runs-on: [ubuntu-latest] permissions: packages: write contents: read diff --git a/README.md b/README.md index 125c9bd..82a6862 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,9 @@ Environment variables: * `CLICKHOUSE_DB` - ClickHouse database for inserts, default `default` * `RABBIT_HOST` - RabbitMQ host for subscribe, default `localhost` * `RABBIT_STOMP_PORT` - RabbitMQ STOMP port, default `61613` -* `RABBIT_QUEUE` - RabbitMQ queue for buffer data +* `RABBIT_USER` - RabbitMQ STOMP login user, default `guest` +* `RABBIT_PASSWORD` - RabbitMQ STOMP login password, default `guest` +* `RABBIT_QUEUE` - RabbitMQ queue for buffer data, default `clickhouse` * `MAX_DELAY` - time flush data to ClickHouse, default `5` * `MAX_FILE_SIZE` - max buffer size before flush to ClickHouse, default `5242880` diff --git a/examples/run.php b/examples/run.php index 2cbcc8a..b0d6da0 100644 --- a/examples/run.php +++ b/examples/run.php @@ -21,10 +21,12 @@ 'host' => getenv('CLICKHOUSE_HOST'), 'port' => getenv('CLICKHOUSE_PORT'), ], - 'stomp' => [ - 'host' => getenv('RABBIT_HOST'), - 'port' => getenv('RABBIT_STOMP_PORT'), - 'queue' => getenv('RABBIT_QUEUE') ?: 'clickhouse', + 'stomp' => [ + 'host' => getenv('RABBIT_HOST'), + 'port' => getenv('RABBIT_STOMP_PORT'), + 'user' => getenv('RABBIT_USER'), + 'password' => getenv('RABBIT_PASSWORD'), + 'queue' => getenv('RABBIT_QUEUE') ?: 'clickhouse', ], 'max_delay' => getenv('MAX_DELAY'), 'max_file_size' => getenv('MAX_FILE_SIZE'), diff --git a/src/ClickhouseWorker.php b/src/ClickhouseWorker.php index e76edef..51d43eb 100644 --- a/src/ClickhouseWorker.php +++ b/src/ClickhouseWorker.php @@ -255,8 +255,8 @@ protected function processing(string $file, string $table): void { */ private function stompConnect(): void { $this->client = new Client('stomp://' . ($this->config['stomp']['host'] ?? null ?: '127.0.0.1') . ':' . ($this->config['stomp']['port'] ?? null ?: 61613), array_filter([ - 'login' => $this->config['stomp']['user'] ?? null, - 'passcode' => $this->config['stomp']['password'] ?? null, + 'login' => $this->config['stomp']['user'] ?? null ?: 'guest', + 'passcode' => $this->config['stomp']['password'] ?? null ?: 'guest', 'reconnect_period' => 1, ]));