5

I'm trying to access APP_KEY env variable of laravel in my socket.io server installation, but don't know how to access any of the laravel environment variables.

Any help is appreciated.

2 Answers 2

4

check this package for node.js dotenv

You can define path to .env file as

require('dotenv').config({path: '/custom/path/to/laravel/'});

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you so much, this was all I needed. :-)
-3

If they’re defined in the .env file then you can’t: it’s a PHP package Laravel uses that reads those values and makes them available in the application.

Instead, set actual environment variables on your server or in your host definition. Then both your Laravel application and any other application will be able to read them.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.