-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,557 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Cushon\HealthBundle\CushonHealthBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle; | ||
|
||
return [ | ||
FrameworkBundle::class => ['all' => true], | ||
FriendsOfBehatSymfonyExtensionBundle::class => [ | ||
'test' => true, | ||
'dev' => true, | ||
], | ||
CushonHealthBundle::class => ['all' => true], | ||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | ||
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'dev' => true], | ||
Cushon\HealthBundle\CushonHealthBundle::class => ['all' => true], | ||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], | ||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
parameters: | ||
env(DB_READ_HOST): '127.0.0.1' | ||
env(DB_READ_NAME): 'health_example' | ||
env(DB_READ_USER): 'cushon_read' | ||
env(DB_READ_VERSION): 'mariadb-10.7.3' | ||
env(DB_READ_PORT): 3306 | ||
|
||
env(DB_WRITE_HOST): '127.0.0.1' | ||
env(DB_WRITE_NAME): 'health_example' | ||
env(DB_WRITE_USER): 'cushon_write' | ||
env(DB_WRITE_VERSION): 'mariadb-10.7.3' | ||
env(DB_WRITE_PORT): 3306 | ||
|
||
doctrine: | ||
dbal: | ||
default_connection: default | ||
connections: | ||
default: | ||
# Connection used for read operations | ||
host: '%env(string:DB_READ_HOST)%' | ||
dbname: '%env(string:DB_READ_NAME)%' | ||
user: '%env(string:DB_READ_USER)%' | ||
password: '%env(string:DB_READ_PASSWORD)%' | ||
server_version: '%env(string:DB_READ_VERSION)%' | ||
port: '%env(int:DB_READ_PORT)%' | ||
driver: 'pdo_mysql' | ||
write: | ||
# Connection used for write operations | ||
host: '%env(string:DB_WRITE_HOST)%' | ||
dbname: '%env(string:DB_WRITE_NAME)%' | ||
user: '%env(string:DB_WRITE_USER)%' | ||
password: '%env(string:DB_WRITE_PASSWORD)%' | ||
server_version: '%env(string:DB_WRITE_VERSION)%' | ||
port: '%env(int:DB_WRITE_PORT)%' | ||
driver: 'pdo_mysql' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
doctrine_migrations: | ||
connection: 'write' | ||
migrations_paths: | ||
# namespace is arbitrary but should be different from App\Migrations | ||
# as migrations classes should NOT be autoloaded | ||
'Example\DoctrineMigrations': '%kernel.project_dir%/migrations' | ||
enable_profiler: '%kernel.debug%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/ApplicationHealth/DependencyCheck/DatabaseCheck.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\ApplicationHealth\DependencyCheck; | ||
|
||
use App\ApplicationHealth\DependencyCheck\DatabaseCheck\HealthDependencyRepository; | ||
use Cushon\HealthBundle\ApplicationHealth\DependencyCheck; | ||
use Cushon\HealthBundle\ApplicationHealth\HealthReport\DependencyStatus; | ||
use Ds\Set; | ||
use Generator; | ||
|
||
final class DatabaseCheck implements DependencyCheck | ||
{ | ||
private Set $dependencyRepositories; | ||
|
||
/** | ||
* @param HealthDependencyRepository ...$dependencyRepositories | ||
*/ | ||
public function __construct(HealthDependencyRepository ...$dependencyRepositories) | ||
{ | ||
$this->dependencyRepositories = new Set($dependencyRepositories); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function check(): Generator | ||
{ | ||
/** @var HealthDependencyRepository $dependencyRepository */ | ||
foreach ($this->dependencyRepositories as $dependencyRepository) { | ||
yield $dependencyRepository->checkUser(); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/ApplicationHealth/DependencyCheck/DatabaseCheck/HealthDependencyRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\ApplicationHealth\DependencyCheck\DatabaseCheck; | ||
|
||
use Cushon\HealthBundle\ApplicationHealth\HealthReport\DependencyStatus; | ||
|
||
interface HealthDependencyRepository | ||
{ | ||
/** | ||
* @return DependencyStatus | ||
*/ | ||
public function checkUser(): DependencyStatus; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.