How to handle environment variables in a deployed SF4 application

Symfony introduced the new Dotenv component with Symfony 3, which allows you to process environment variables as application parameters. It looks very pretty and is best followed according to the 12factor application manifest .

Now, with respect to Symfony 4, they went further by promoting this practice, and so I started using environment variables through the .env file.

And then I wanted to deploy, and I realized that the .env file should not be stored on the server, since it will be the same as the parameters.yml file.

So, I searched the documentation a bit and found this article explaining that we can directly create environment variables through some web server directives. This is great for code running through FPM, but it does not tell us how to process environment variables when running a command through the CLI, for example.

How can i achieve this? Should there be somewhere the equivalent of the .env file? But then the parameters will be duplicated?

I welcome any help;)

+4
source share
1 answer

Finally, it's time to check out the Neodan link and that's it!

, , , , /etc/environment . , .

, . , /, , .

, , , , -, .bash_profile .bashrc, , ( , ). , .

N.B.: , .

0

Source: https://habr.com/ru/post/1692230/


All Articles