43 lines
1.6 KiB
PHP
43 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\DeploymentService;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Apply the effective panel domain (dashboard override in DB, else install-time
|
|
* APP_DOMAIN) to runtime config at boot. boot() runs every request, so a domain
|
|
* change takes effect on the next request after the operator restarts the stack —
|
|
* nothing is switched mid-session, which is what makes it safe.
|
|
*
|
|
* - Server -> Reverb publishing is pinned to the INTERNAL reverb service (both dev
|
|
* and prod compose name it `reverb`), so realtime keeps working right after a
|
|
* domain change and never depends on the new public cert. The browser endpoint is
|
|
* injected by the layout from DeploymentService::reverbClient().
|
|
* - app.url -> https://<domain> so absolute URL generation matches how the panel is
|
|
* served. With no domain (bare IP / dev) the env-derived app.url is left as is.
|
|
*/
|
|
public function boot(DeploymentService $deployment): void
|
|
{
|
|
config([
|
|
'broadcasting.connections.reverb.options.host' => 'reverb',
|
|
'broadcasting.connections.reverb.options.port' => 8080,
|
|
'broadcasting.connections.reverb.options.scheme' => 'http',
|
|
'broadcasting.connections.reverb.options.useTLS' => false,
|
|
]);
|
|
|
|
$domain = $deployment->domain();
|
|
if ($domain !== null) {
|
|
config(['app.url' => 'https://'.$domain]);
|
|
}
|
|
}
|
|
}
|