tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 509 forks source link

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

Open yilufeiyang opened 4 years ago

yilufeiyang commented 4 years ago

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

adm-bome commented 4 years ago

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.

bbrist commented 3 years ago

I'm having the same/similar issue.

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