orocrmorocommerce

OroPlatform: custom environment variables to .env


I'm working on an OroPlatform 4.1.10 project and I have to add some custom variables to my .env file.

As a Symfony based project, I have supposed that the steps are :

Then, if I try to fetch the parameter value : $this->getParameter('helloworld') Here is the error message :

enter image description here

I can add this line (new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); to the index_dev.php as the bootstrap.php file in a classic Symfony.

I am just wondering why it doesn't exist in OroPlatform.


Solution

  • OroPlatform doesn't use dotenv files for now. The platform is based on Symfony full stack framework, but there are some differences.

    Instead of .env, defaults for environment variables are defined in the config/parameters.yml and config/parameters.yml.dist files. See https://doc.oroinc.com/backend/setup/dev-environment/parameters-yml/ for more details.

    Anyway, you can use real environment variables and parameters.yml replaces .env when you want to emulate them locally.