As a symfony user, we also use dotenv. But, when deploying to production the .env file is removed and the variables are saved in actual enviroment var's. That would be the best way to do it i think.
Environment variables are set within the OS itself and the application then reads them (via getenv or $_ENV in PHP, I believe). My colleague Dominik wrote a great post about how to set environment variables on different platforms which you might be interested in.
Correct, that is what i meant. The dotenv file (at least in symfony), is used for local development. Once you deploy a symfony project, it wil check if you removed the .env file. If the file still exists, your app will throw an error, thus making it so people HAVE to get rid of it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As a symfony user, we also use dotenv. But, when deploying to production the .env file is removed and the variables are saved in actual enviroment var's. That would be the best way to do it i think.
Agreed that this would be the best way. Iām a little concerned if Laravel itself is mandating using the .env file in production.
Hey, I'm little confused on "actual environment var's". can you show a little example of symfony how you do this without .env file? :)
Environment variables are set within the OS itself and the application then reads them (via
getenv
or$_ENV
in PHP, I believe). My colleague Dominik wrote a great post about how to set environment variables on different platforms which you might be interested in.Correct, that is what i meant. The dotenv file (at least in symfony), is used for local development. Once you deploy a symfony project, it wil check if you removed the .env file. If the file still exists, your app will throw an error, thus making it so people HAVE to get rid of it.