Skip to content

Commit

Permalink
Merge pull request #36 from LouisTrezzini/feature/raven-options
Browse files Browse the repository at this point in the history
Give access to all of the RavenClient options
  • Loading branch information
dcramer authored Dec 30, 2016
2 parents 235aab6 + 20df593 commit 4250536
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Sentry/SentryBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public function getConfigTreeBuilder()
->scalarNode('dsn')
->defaultNull()
->end()
->arrayNode('options')
->treatNullLike(array())
->prototype('scalar')->end()
->defaultValue(array())
->end()
->scalarNode('error_types')
->defaultNull()
->end()
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/SentryBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
sentry.client:
class: '%sentry.client%'
arguments: ['%sentry.dsn%', {'error_types': '%sentry.error_types%'}]
arguments: ['%sentry.dsn%', %sentry.options%, '%sentry.error_types%']
calls:
- [setRelease, ['%sentry.release%']]
- [setEnvironment, ['%sentry.environment%']]
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/SentryBundle/SentrySymfonyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

class SentrySymfonyClient extends \Raven_Client
{
public function __construct($dsn=null, $options=array())
public function __construct($dsn=null, $options=array(), $error_types='')
{
if (array_key_exists('error_types', $options)) {
$exParser = new ErrorTypesParser($options['error_types']);
if (is_string($error_types) && !empty($error_types)) {
$exParser = new ErrorTypesParser($error_types);
$options['error_types'] = $exParser->parse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ public function test_that_it_uses_dsn_value()
);
}

public function test_that_it_uses_options_value()
{
$container = $this->getContainer(array(
static::CONFIG_ROOT => array(
'options' => array(
'http_proxy' => 'http://user:password@host:port'
),
),
));

$options = $container->getParameter('sentry.options');

$this->assertSame(
'http://user:password@host:port',
$options['http_proxy']
);
}

public function test_that_it_uses_defined_class_as_exception_listener_class_by_default()
{
$container = $this->getContainer();
Expand Down

0 comments on commit 4250536

Please sign in to comment.