laravel-echo-server icon indicating copy to clipboard operation
laravel-echo-server copied to clipboard

A bug was found. Unable to load .env file with the same directory as laravel-echo-server.json file

Open yilufeiyang opened this issue 4 years ago • 2 comments

After the working directory is set, only laravel-echo-server.json files can be loaded, .env files under the same directory cannot be loaded. So the config options in the laravel-echo-server.json file cannot be overwritten by the .env file.

in working directory(/var/www/my-website)

.env LARAVEL_ECHO_SERVER_AUTH_HOST=http://localhost LARAVEL_ECHO_SERVER_PORT=6001 LARAVEL_ECHO_SERVER_DEBUG=true

laravel-echo-server.json { "authHost": "http://api-dev", "authEndpoint": "/broadcasting/auth", "devMode": false }

Execute in non working directory $ cd /home $ laravel-echo-server start --dir=/var/www/my-website

The following information is displayed L A R A V E L E C H O S E R V E R

version 1.6.1 ✔ Running at localhost on port 6001 ✔ Channels are ready. ✔ Listening for http events... ✔ Listening for redis events...

Server ready!

Execute in working directory $ cd /var/www/my-website $ laravel-echo-server start or $ laravel-echo-server start --dir=/var/www/my-website

The following information is displayed L A R A V E L E C H O S E R V E R

Starting server in DEV mode...

version 1.6.1 ✔ Running at localhost on port 6001 ✔ Channels are ready. ✔ Listening for http events... ✔ Listening for redis events...

Server ready!

Obviously, the . env file doesn't work

yilufeiyang avatar Apr 26 '20 03:04 yilufeiyang

It works but u have to know how to apply an env file. The file will not auto apply the content to the system variables by just sitting at the file system.

Most people use a docker image and apply the env file to the running container. This is done by the docker engine.

An other method is to run a command via script or manual. U can use source command to eval the contents of a file.

Ohw and if I'm not mistaking: the environment variables will only be used if no laravel-echo-server.json file is present on the system. If its present it does not regenerate the config.

adm-bome avatar Apr 28 '20 17:04 adm-bome

I'm having the same/similar issue.

  • .env is in same directory as laravel-echo-server.json.
  • I'm overriding the port successfully using LARAVEL_ECHO_SERVER_PORT

However, attempts to override ssl cert/key and debug do not work using:

  • LARAVEL_ECHO_SERVER_DEBUG
  • LARAVEL_ECHO_SERVER_SSL_KEY
  • LARAVEL_ECHO_SERVER_SSL_CERT
  • LARAVEL_ECHO_SERVER_PROTO

bbrist avatar Aug 01 '21 00:08 bbrist