问题
I have the same problem as asked here.
Followed Symfony Secrets Docu exactly as described.
- Generated the keys.
- Created the secret variable -
php bin/console secrets:set APPLICATION_SECRET_KEY
- The variable is there with the right value -
php bin/console secrets:list --reveal
- Added the following parameter to services.yaml
parameters: myapp.application_secret_key: '%env(APPLICATION_SECRET_KEY)%'
- Trying to access the key from the controller by -
$apiSecret = $this->getParameter('myapp.application_secret_key');
which results in an "not found" exception:
Environment variable not found: "APPLICATION_SECRET_KEY".
Any idea what I am missing?
来源:https://stackoverflow.com/questions/61158661/symfony-cant-find-environment-variable-in-the-secrets