I am currently using Algolia for my search engine in the Laravel application, so when I create an entry, it is also sent to the Agolia database. Of course, I want to share my data in an Algolia database with a test suite for local development and a production kit for a live website. I determined which indexes of my Algolia database are used in the JavaScript file.
Now I am wondering how I react accordingly to my variable APP_ENV to change it depending on my current environment? Obviously, I need to put things in an if in my JavaScript, but how do I get my JavaScript to access .env variables correctly?
Hope someone can help me.
Greetings.
javascript php environment-variables laravel
Stephan-v
source share