fix: inyectar config de Reverb desde PHP en runtime para producción
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,14 @@ import Pusher from 'pusher-js';
|
||||
|
||||
window.Pusher = Pusher;
|
||||
|
||||
const cfg = window.reverbConfig ?? {};
|
||||
|
||||
window.Echo = new Echo({
|
||||
broadcaster: 'reverb',
|
||||
key: import.meta.env.VITE_REVERB_APP_KEY,
|
||||
wsHost: import.meta.env.VITE_REVERB_HOST,
|
||||
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
|
||||
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
|
||||
forceTLS: false,
|
||||
broadcaster: 'reverb',
|
||||
key: cfg.key ?? import.meta.env.VITE_REVERB_APP_KEY,
|
||||
wsHost: cfg.host ?? import.meta.env.VITE_REVERB_HOST,
|
||||
wsPort: cfg.port ?? import.meta.env.VITE_REVERB_PORT ?? 80,
|
||||
wssPort: cfg.port ?? import.meta.env.VITE_REVERB_PORT ?? 443,
|
||||
forceTLS: cfg.forceTLS ?? false,
|
||||
enabledTransports: ['ws', 'wss'],
|
||||
});
|
||||
|
||||
@@ -28,6 +28,17 @@
|
||||
{{-- Livewire --}}
|
||||
@livewireScripts
|
||||
|
||||
{{-- Config de Reverb inyectada en runtime para que funcione en producción --}}
|
||||
<script>
|
||||
window.reverbConfig = {
|
||||
key: '{{ config('reverb.apps.apps.0.key') }}',
|
||||
host: '{{ parse_url(config('app.url'), PHP_URL_HOST) }}',
|
||||
port: {{ env('REVERB_PORT', 8080) }},
|
||||
scheme: '{{ str_starts_with(config('app.url'), 'https') ? 'https' : 'http' }}',
|
||||
forceTLS: {{ str_starts_with(config('app.url'), 'https') ? 'true' : 'false' }},
|
||||
};
|
||||
</script>
|
||||
|
||||
{{-- Vite (Echo/Reverb) --}}
|
||||
@vite(['resources/js/app.js'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user