Skip to content

Commit

Permalink
Merge pull request #1865 from annuh/issue-1596-support-aws_credential…
Browse files Browse the repository at this point in the history
…_provider

Add support for 'aws_credential_provider'
  • Loading branch information
XWB authored Jul 20, 2022
2 parents a4d33c1 + 43ba634 commit b8d71ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ private function addClientsSection(ArrayNodeDefinition $rootNode)
->scalarNode('aws_secret_access_key')->end()
->scalarNode('aws_region')->end()
->scalarNode('aws_session_token')->end()
->scalarNode('aws_credential_provider')->end()
->booleanNode('ssl')->defaultValue(false)->end()
->scalarNode('logger')
->defaultValue($this->debug ? 'fos_elastica.logger' : false)
Expand Down
8 changes: 8 additions & 0 deletions src/DependencyInjection/FOSElasticaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ private function loadClients(array $clients, ContainerBuilder $container): void
foreach ($clients as $name => $clientConfig) {
$clientId = \sprintf('fos_elastica.client.%s', $name);

if (isset($clientConfig['connections'])) {
foreach ($clientConfig['connections'] as $connectionIndex => $connectionConfig) {
if (isset($connectionConfig['aws_credential_provider'])) {
$clientConfig['connections'][$connectionIndex]['aws_credential_provider'] = new Reference($connectionConfig['aws_credential_provider']);
}
}
}

$clientDef = new ChildDefinition('fos_elastica.client_prototype');
$clientDef->replaceArgument(0, $clientConfig);
$clientDef->replaceArgument(1, null);
Expand Down

0 comments on commit b8d71ea

Please sign in to comment.