25 lines
715 B
PHP

<?php declare(strict_types=1);
namespace App\Services\Private;
use App\ServiceResults\Private\Websocket\Setting;
use App\ServiceResults\ServiceResultError;
use App\Services\Service;
final class WebsocketService extends Service
{
public function settings(): ServiceResultError | Setting
{
$config = config('reverb.apps');
$config = $config['apps'][0] ?? [];
return new Setting(
key: $config['key'] ?? '',
wsHost: $config['options_for_client']['host'] ?? '',
wsPort: (int) $config['options_for_client']['port'] ?? 80,
wssPort: 443,
forceTLS: $config['options_for_client']['useTLS'] ?? false,
);
}
}