Yesterday was the first time I made a deploy in an own server with Symfony 4. Reading the official documentation about deployment, I quote:
Most Symfony applications read their configuration from environment variables. While developing locally, you'll usually store these in a .env file. But on production, instead of creating this file, you should set real environment variables.
Now, since I read on multiple sites that that's the correct way to work in production, I have several doubts about it:
- What is the meaning of environment variables in production? Why not just have the variables in a file like Wordpress, Django, and others?
- Why would I like have the credentials of my project's database in a global OS variable???
- Being globals and accessible by all in the OS, if I would have more than one project with the same env var (for instance,
APP_ENV
in Symfony), changing its value would affect all my projects! Does It make any sense?
If anyone could throw a little light on the subject, I would appreciate it very much.
Sorry about my English