Load site settings from dotenv and store OAuth credentials

This commit is contained in:
2026-11-23 16:53:29 +08:00
parent 1bb0554608
commit 01ede89dcd
27 changed files with 730 additions and 76 deletions
+1 -5
View File
@@ -19,12 +19,8 @@ final class IdentityProvider
private readonly Client $http;
private array $oidc = [];
public function __construct(private readonly array $config)
public function __construct(private readonly array $config, string $secret)
{
$secret = getenv($config['secret_env']);
if (!is_string($secret) || $secret === '') {
throw new RuntimeException('身份服务的客户端密钥尚未配置。');
}
$this->http = new Client(['timeout' => 8, 'connect_timeout' => 4, 'allow_redirects' => false]);
$scope = preg_split('/\s+/', trim($config['scope']), -1, PREG_SPLIT_NO_EMPTY);
$authorization = $config['authorization'];