Skip to content

Commit 3637e62

Browse files
authored
Inherit AWS_MERGE_CONFIG value from .env files (#87)
Inherit AWS_MERGE_CONFIG value from .env files
1 parent 9b3bc9e commit 3637e62

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/DependencyInjection/Configuration.php

+22-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Configuration implements ConfigurationInterface
1111
public function getConfigTreeBuilder()
1212
{
1313
// Maintain backwars compatibility, only merge when AWS_MERGE_CONFIG is set
14-
$mergeConfig = getenv('AWS_MERGE_CONFIG') ?: false;
14+
$mergeConfig = $this->shouldMergeConfig();
1515
$treeType = 'variable';
1616

1717
if ($mergeConfig) {
@@ -117,4 +117,25 @@ public function getConfigTreeBuilder()
117117

118118
return $treeBuilder;
119119
}
120+
121+
protected function shouldMergeConfig()
122+
{
123+
# works with symfony/dotenv
124+
if (isset($_ENV['AWS_MERGE_CONFIG'])) {
125+
return $_ENV['AWS_MERGE_CONFIG'];
126+
}
127+
128+
# works with case-insensitive names on windows and doesn't work with symfony/dotenv
129+
$mergeConfig = getenv('AWS_MERGE_CONFIG');
130+
131+
if ($mergeConfig) {
132+
@trigger_error(
133+
'Since aws/aws-sdk-php-symfony 2.5.0: Support for case-insensitive'
134+
. ' AWS_MERGE_CONFIG is deprecated and will be removed in 3.0.0',
135+
\E_USER_DEPRECATED
136+
);
137+
}
138+
139+
return $mergeConfig;
140+
}
120141
}

0 commit comments

Comments
 (0)