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 :
.env
file : HELLOWORLD="helloworld"
services.yaml
file : helloworld: '%env(HELLOWORLD)%'
Then, if I try to fetch the parameter value : $this->getParameter('helloworld')
Here is the error message :
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.
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.