Skip to content

Commit 4250536

Browse files
authored
Merge pull request #36 from LouisTrezzini/feature/raven-options
Give access to all of the RavenClient options
2 parents 235aab6 + 20df593 commit 4250536

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/Sentry/SentryBundle/DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public function getConfigTreeBuilder()
3434
->scalarNode('dsn')
3535
->defaultNull()
3636
->end()
37+
->arrayNode('options')
38+
->treatNullLike(array())
39+
->prototype('scalar')->end()
40+
->defaultValue(array())
41+
->end()
3742
->scalarNode('error_types')
3843
->defaultNull()
3944
->end()

src/Sentry/SentryBundle/Resources/config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
sentry.client:
33
class: '%sentry.client%'
4-
arguments: ['%sentry.dsn%', {'error_types': '%sentry.error_types%'}]
4+
arguments: ['%sentry.dsn%', %sentry.options%, '%sentry.error_types%']
55
calls:
66
- [setRelease, ['%sentry.release%']]
77
- [setEnvironment, ['%sentry.environment%']]

src/Sentry/SentryBundle/SentrySymfonyClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
class SentrySymfonyClient extends \Raven_Client
66
{
7-
public function __construct($dsn=null, $options=array())
7+
public function __construct($dsn=null, $options=array(), $error_types='')
88
{
9-
if (array_key_exists('error_types', $options)) {
10-
$exParser = new ErrorTypesParser($options['error_types']);
9+
if (is_string($error_types) && !empty($error_types)) {
10+
$exParser = new ErrorTypesParser($error_types);
1111
$options['error_types'] = $exParser->parse();
1212
}
1313

test/Sentry/SentryBundle/Test/DependencyInjection/ExtensionTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ public function test_that_it_uses_dsn_value()
115115
);
116116
}
117117

118+
public function test_that_it_uses_options_value()
119+
{
120+
$container = $this->getContainer(array(
121+
static::CONFIG_ROOT => array(
122+
'options' => array(
123+
'http_proxy' => 'http://user:password@host:port'
124+
),
125+
),
126+
));
127+
128+
$options = $container->getParameter('sentry.options');
129+
130+
$this->assertSame(
131+
'http://user:password@host:port',
132+
$options['http_proxy']
133+
);
134+
}
135+
118136
public function test_that_it_uses_defined_class_as_exception_listener_class_by_default()
119137
{
120138
$container = $this->getContainer();

0 commit comments

Comments
 (0)