mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
retrieve rabbitmq configuration from configuration.yml
This commit is contained in:
@@ -32,11 +32,12 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
|
||||
$app['alchemy_queues.queues'] = $app->share(function (Application $app) {
|
||||
$defaultConfiguration = [
|
||||
'worker-queue' => [
|
||||
'registry' => 'alchemy_worker.queue_registry',
|
||||
'host' => 'localhost',
|
||||
'port' => 5672,
|
||||
'user' => 'guest',
|
||||
'vhost' => '/'
|
||||
'registry' => 'alchemy_worker.queue_registry',
|
||||
'host' => 'localhost',
|
||||
'port' => 5672,
|
||||
'user' => 'guest',
|
||||
'password' => 'guest',
|
||||
'vhost' => '/'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -46,19 +47,22 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
|
||||
|
||||
$queueConfigurations = $configuration->get(['workers', 'queue'], $defaultConfiguration);
|
||||
|
||||
$queueConfiguration = reset($queueConfigurations);
|
||||
$queueKey = key($queueConfigurations);
|
||||
$config = [];
|
||||
|
||||
if (! isset($queueConfiguration['name'])) {
|
||||
if (! is_string($queueKey)) {
|
||||
throw new \RuntimeException('Invalid queue configuration: configuration has no key or name.');
|
||||
foreach($queueConfigurations as $name => $queueConfiguration) {
|
||||
$queueKey = $name;
|
||||
|
||||
if (! isset($queueConfiguration['name'])) {
|
||||
if (! is_string($queueKey)) {
|
||||
throw new \RuntimeException('Invalid queue configuration: configuration has no key or name.');
|
||||
}
|
||||
|
||||
$queueConfiguration['name'] = $queueKey;
|
||||
}
|
||||
|
||||
$queueConfiguration['name'] = $queueKey;
|
||||
$config[$queueConfiguration['name']] = $queueConfiguration ;
|
||||
}
|
||||
|
||||
$config = [ $queueConfiguration['name'] => $queueConfiguration ];
|
||||
|
||||
return $config;
|
||||
}
|
||||
catch (RuntimeException $exception) {
|
||||
|
Reference in New Issue
Block a user