Skip to content

Commit fe3e3f2

Browse files
authored
[Symfony] Make sure we can override config (#795)
* [Symfony] Make sure we can override config * cs * Added changelog
1 parent fe239f3 commit fe3e3f2

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## NOT RELEASED
44

5+
## 1.1.1
6+
7+
### Fixed
8+
9+
- Make sure you can override config in different environments.
10+
511
## 1.1.0
612

713
### Added

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ public function getConfigTreeBuilder()
2525
->scalarNode('credential_provider_cache')->info('A service implementing Symfony\Contracts\Cache\CacheInterface to efficiently cache credentials.')->defaultValue('cache.app')->end()
2626
->scalarNode('http_client')->info('A service name for Symfony\Contracts\HttpClient\HttpClientInterface.')->end()
2727
->scalarNode('logger')->info('A service name for Psr\Log\LoggerInterface.')->end()
28-
->arrayNode('config')->info('Default config that will be merged will all services.')->normalizeKeys(false)->prototype('variable')->end()->end()
28+
->arrayNode('config')->info('Default config that will be merged will all services.')->useAttributeAsKey('name')->normalizeKeys(false)->prototype('variable')->end()->end()
2929

3030
->arrayNode('clients')
3131
->beforeNormalization()->always()->then(\Closure::fromCallable([$this, 'validateType']))->end()
3232
->useAttributeAsKey('name')
3333
->arrayPrototype()
3434
->children()
3535
->booleanNode('register_service')->info('If set to false, no service will be created for this AWS type.')->defaultTrue()->end()
36-
->arrayNode('config')->info('Configuration specific to this service.')->normalizeKeys(false)->prototype('variable')->end()->end()
36+
->arrayNode('config')->info('Configuration specific to this service.')->useAttributeAsKey('name')->normalizeKeys(false)->prototype('variable')->end()->end()
3737
->enumNode('type')->info('A valid AWS type. The service name will be used as default.')->values(AwsPackagesProvider::getServiceNames())->end()
3838
->scalarNode('credential_provider')->info('A service name for AsyncAws\Core\Credentials\CredentialProvider.')->end()
3939
->scalarNode('http_client')->info('A service name for Symfony\Contracts\HttpClient\HttpClientInterface.')->end()

tests/Functional/BundleInitializationTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ public function testExceptionWhenConfigureServiceNotInstalled()
146146
$this->bootKernel();
147147
}
148148

149+
public function testIssue793()
150+
{
151+
$kernel = $this->createKernel();
152+
$kernel->addConfigFile(__DIR__ . '/Resources/config/issue-793/default.yaml');
153+
$kernel->addConfigFile(__DIR__ . '/Resources/config/issue-793/dev.yaml');
154+
155+
$this->bootKernel();
156+
$container = $this->getContainer();
157+
$x = $container->get(S3Client::class);
158+
self::assertSame('./docker/dynamodb/credentials', $x->getConfiguration()->get('sharedCredentialsFile'));
159+
}
160+
149161
protected function getBundleClass()
150162
{
151163
return AsyncAwsBundle::class;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
framework:
2+
router:
3+
utf8: true
4+
async_aws:
5+
config:
6+
sharedCredentialsFile: ~
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
async_aws:
2+
config:
3+
sharedCredentialsFile: './docker/dynamodb/credentials'

0 commit comments

Comments
 (0)