Skip to content

Commit

Permalink
add env rabbit user & pass
Browse files Browse the repository at this point in the history
  • Loading branch information
PNixx committed Sep 25, 2024
1 parent 63fd022 commit 304d2b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
10 changes: 6 additions & 4 deletions examples/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
4 changes: 2 additions & 2 deletions src/ClickhouseWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]));

Expand Down

0 comments on commit 304d2b6

Please sign in to comment.