#132: Added support for using vhosts with RabbitMQ
This commit is contained in:
parent
3c6c5b174d
commit
d0d322120a
@ -128,6 +128,7 @@ class ConfigHelper
|
||||
'rabbitmq_port' => 5672,
|
||||
'rabbitmq_queue' => 'blue_twilight',
|
||||
'rabbitmq_username' => 'guest',
|
||||
'rabbitmq_vhost' => '/',
|
||||
'recaptcha_enabled_registration' => false,
|
||||
'recaptcha_secret_key' => '',
|
||||
'recaptcha_site_key' => '',
|
||||
@ -210,7 +211,8 @@ class ConfigHelper
|
||||
!empty($this->get('rabbitmq_port')) &&
|
||||
!empty($this->get('rabbitmq_username')) &&
|
||||
!empty($this->get('rabbitmq_password')) &&
|
||||
!empty($this->get('rabbitmq_queue'));
|
||||
!empty($this->get('rabbitmq_queue')) &&
|
||||
!empty($this->get('rabbitmq_vhost'));
|
||||
}
|
||||
|
||||
public function isSocialMediaLoginEnabled()
|
||||
|
@ -3,12 +3,10 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Album;
|
||||
use App\Configuration;
|
||||
use App\Facade\Theme;
|
||||
use App\Facade\UserConfig;
|
||||
use App\Group;
|
||||
use App\Helpers\AnalysisQueueHelper;
|
||||
use App\Helpers\ConfigHelper;
|
||||
use App\Helpers\DbHelper;
|
||||
use App\Helpers\MiscHelper;
|
||||
use App\Helpers\PermissionsHelper;
|
||||
@ -19,12 +17,10 @@ use App\Mail\TestMailConfig;
|
||||
use App\Photo;
|
||||
use App\PhotoComment;
|
||||
use App\Services\GiteaService;
|
||||
use App\Services\GithubService;
|
||||
use App\Services\PhotoService;
|
||||
use App\Storage;
|
||||
use App\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
@ -275,6 +271,7 @@ class DefaultController extends Controller
|
||||
'rabbitmq_username',
|
||||
'rabbitmq_password',
|
||||
'rabbitmq_queue',
|
||||
'rabbitmq_vhost',
|
||||
'sender_address',
|
||||
'sender_name',
|
||||
'smtp_server',
|
||||
|
@ -19,6 +19,8 @@ class RabbitMQService
|
||||
protected $server;
|
||||
|
||||
protected $username;
|
||||
|
||||
protected $vhost;
|
||||
|
||||
/**
|
||||
* @var AMQPChannel
|
||||
@ -37,6 +39,9 @@ class RabbitMQService
|
||||
$this->username = UserConfig::get('rabbitmq_username');
|
||||
$this->password = decrypt(UserConfig::get('rabbitmq_password'));
|
||||
$this->queue = UserConfig::get('rabbitmq_queue');
|
||||
|
||||
$vhost = UserConfig::get('rabbitmq_vhost');
|
||||
$this->vhost = empty($vhost) ? '/' : $vhost;
|
||||
}
|
||||
|
||||
public function queueItem(QueueItem $queueItem)
|
||||
@ -78,7 +83,7 @@ class RabbitMQService
|
||||
|
||||
private function connectAndInit()
|
||||
{
|
||||
$this->connection = new AMQPStreamConnection($this->server, $this->port, $this->username, $this->password);
|
||||
$this->connection = new AMQPStreamConnection($this->server, $this->port, $this->username, $this->password, $this->vhost);
|
||||
$this->channel = $this->connection->channel();
|
||||
|
||||
$this->channel->queue_declare($this->queue, false, true, false, false);
|
||||
|
@ -182,6 +182,17 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group ml-4">
|
||||
<label class="form-control-label" for="rabbitmq-vhost">Virtual host:</label>
|
||||
<input type="text" class="form-control{{ $errors->has('rabbitmq_vhost') ? ' is-invalid' : '' }}" id="rabbitmq-vhost" name="rabbitmq_vhost" value="{{ old('rabbitmq_vhost', $config['rabbitmq_vhost']) }}">
|
||||
|
||||
@if ($errors->has('rabbitmq_vhost'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('rabbitmq_vhost') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group ml-4">
|
||||
<label class="form-control-label" for="rabbitmq-queue">Queue:</label>
|
||||
<input type="text" class="form-control{{ $errors->has('rabbitmq_queue') ? ' is-invalid' : '' }}" id="rabbitmq-queue" name="rabbitmq_queue" value="{{ old('rabbitmq_queue', $config['rabbitmq_queue']) }}">
|
||||
|
Loading…
Reference in New Issue
Block a user