add admin command

This commit is contained in:
Yisroel Baum 2026-07-02 01:21:04 +03:00
parent 4462879b7d
commit fee174ec05
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
7 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<?php
namespace App\User;
use RuntimeException;
class EnvironmentInitialAdminCredentialsProvider implements
InitialAdminCredentialsProvider
{
public function getCredentials(): InitialAdminCredentials
{
return new InitialAdminCredentials(
email: $this->requiredEnvironmentValue(
'RABBI_GERZI_INITIAL_ADMIN_EMAIL',
),
password: $this->requiredEnvironmentValue(
'RABBI_GERZI_INITIAL_ADMIN_PASSWORD',
),
);
}
private function requiredEnvironmentValue(string $key): string
{
$value = getenv($key);
if (! is_string($value) || trim($value) === '') {
throw new RuntimeException("$key is required");
}
return $value;
}
}