Skip to content

Commit 95eeb53

Browse files
GrahamCampbellkattrali
authored andcommitted
Support setting release stage direct from config (#39)
1 parent 8a2fc2e commit 95eeb53

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

DependencyInjection/ClientFactory.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ class ClientFactory
118118
*/
119119
protected $root;
120120

121+
/**
122+
* The environment name.
123+
*
124+
* @var string|null
125+
*/
126+
protected $env;
127+
121128
/**
122129
* The release stage.
123130
*
@@ -157,6 +164,7 @@ class ClientFactory
157164
* @param string|null $strip
158165
* @param string|null $project
159166
* @param string|null $root
167+
* @param string|null $env
160168
* @param string|null $stage
161169
* @param string[]|null $stages
162170
* @param string[]|null $filters
@@ -179,6 +187,7 @@ public function __construct(
179187
$strip = null,
180188
$project = null,
181189
$root = null,
190+
$env = null,
182191
$stage = null,
183192
array $stages = null,
184193
array $filters = null
@@ -198,6 +207,7 @@ public function __construct(
198207
$this->strip = $strip;
199208
$this->project = $project;
200209
$this->root = $root;
210+
$this->env = $env;
201211
$this->stage = $stage;
202212
$this->stages = $stages;
203213
$this->filters = $filters;
@@ -224,7 +234,7 @@ public function make()
224234

225235
$this->setupPaths($client, $this->strip, $this->project, $this->root);
226236

227-
$client->setReleaseStage($this->stage === 'prod' ? 'production' : $this->stage);
237+
$client->setReleaseStage($this->stage ?: ($this->env === 'prod' ? 'production' : $this->env));
228238

229239
$client->setAppVersion($this->version);
230240
$client->setFallbackType('Console');

DependencyInjection/Configuration.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public function getConfigTreeBuilder()
4949
->booleanNode('send_code')
5050
->defaultValue(true)
5151
->end()
52+
->scalarNode('release_stage')
53+
->defaultNull()
54+
->end()
5255
->scalarNode('strip_path')
5356
->defaultNull()
5457
->end()

Resources/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- '%bugsnag.project_root%'
2222
- '%kernel.root_dir%'
2323
- '%kernel.environment%'
24+
- '%bugsnag.release_stage%'
2425
- '%bugsnag.notify_release_stages%'
2526
- '%bugsnag.filters%'
2627

0 commit comments

Comments
 (0)