Skip to content

Commit

Permalink
Refactor butler-health config
Browse files Browse the repository at this point in the history
  • Loading branch information
ttrig committed Sep 30, 2021
1 parent 2be304e commit e60f3e6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed
- Refactor butler-health config.
- Refactor butler-audit config.
- Merge package and application "butler" config.

Expand Down
2 changes: 0 additions & 2 deletions config/butler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

'health' => [

'route' => false,

'checks' => [],

],
Expand Down
8 changes: 7 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ protected function configureHealth()
'butlerService' => ltrim(InstalledVersions::getPrettyVersion('glesys/butler-service'), 'v'),
]);

if (! $this->app->configurationIsCached() && config('butler.health.core', true)) {
if ($this->app->configurationIsCached()) {
return;
}

config(['butler.health.route' => false]);

if (config('butler.health.core', true)) {
config([
'butler.health.checks' => array_merge([
HealthChecks\Database::class,
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function test_configureAudit_sets_initiator_resolver_for_unauthenticated_
&& $data->hasInitiatorContext('userAgent', 'Symfony'));
}

public function test_health_is_configured()
public function test_configureHealth_configures_health()
{
$this->assertFalse(config('butler.health.route'));

Expand Down
2 changes: 0 additions & 2 deletions tests/config/butler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

'health' => [

'route' => false,

'checks' => [
Butler\Service\Tests\TestCheck::class,
],
Expand Down

0 comments on commit e60f3e6

Please sign in to comment.