Laravel 5.3,ECHO和Pusher,将Pusher的秘密输出到.env

I'm using Laravel 5.3 with Pusher and all is working well.

However I would like to export my Pusher credentials to .env. Or anywhere else so that I can easily use different Pusher apps on my dev/staging/production environments.

This is my setup:

import Echo from "laravel-echo"

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'myKey', //development key
    cluster: 'eu',
    encrypted: true
});

In gulpfile.js I have

elixir(function(mix) {
    mix.webpack('echo.js','./resources/assets/js/');
});

then

mix.scripts([
    'echo.js',
    ...
], 'public/js/all.js');

And finally in my view:

let myRoom = 'room-user-'+'{{ Auth::user()->id }}';
    Echo.private(myRoom)
        .listen('MyEvent', (e) => {
            console.log(e);
        });

As I said this is all working well.

My problem is the key: 'myKey', //development key. Is there a simple way to use Laravel environment variable env('PUSHER_KEY') here? Because as things are now I need to use the same Pusher App in my development, staging and production.

Also my config/broadcasting is

'connections' => [

    'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_KEY'),
        'secret' => env('PUSHER_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_CLUSTER','eu'),
            'encrypted' => true,
        ],
    ],

I ended up using laravel-elixir-env library as:

gulpfile.js

var elixir = require('laravel-elixir');
require('laravel-elixir-env');
...
elixir(function(mix) {
   mix.webpack('echo.js','./resources/assets/js/');
});
...

echo.js

import Echo from "laravel-echo"
window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.PUSHER_KEY,
    cluster: 'eu',
    encrypted: true
});

.env

...
PUSHER_KEY=my_pusher_key
...