retrieve rabbitmq configuration from configuration.yml

This commit is contained in:
aynsix
2019-09-20 16:03:54 +04:00
parent 7541885637
commit c712cb7cc3

View File

@@ -36,6 +36,7 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'vhost' => '/'
]
];
@@ -46,8 +47,10 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
$queueConfigurations = $configuration->get(['workers', 'queue'], $defaultConfiguration);
$queueConfiguration = reset($queueConfigurations);
$queueKey = key($queueConfigurations);
$config = [];
foreach($queueConfigurations as $name => $queueConfiguration) {
$queueKey = $name;
if (! isset($queueConfiguration['name'])) {
if (! is_string($queueKey)) {
@@ -57,7 +60,8 @@ class WorkerConfigurationServiceProvider implements ServiceProviderInterface
$queueConfiguration['name'] = $queueKey;
}
$config = [ $queueConfiguration['name'] => $queueConfiguration ];
$config[$queueConfiguration['name']] = $queueConfiguration ;
}
return $config;
}