Symfony can't find environment variable in the secrets

给你一囗甜甜゛ 提交于 2021-02-11 08:02:00

问题


I have the same problem as asked here.

Followed Symfony Secrets Docu exactly as described.

  1. Generated the keys.
  2. Created the secret variable - php bin/console secrets:set APPLICATION_SECRET_KEY
  3. The variable is there with the right value - php bin/console secrets:list --reveal
  4. Added the following parameter to services.yaml parameters: myapp.application_secret_key: '%env(APPLICATION_SECRET_KEY)%'
  5. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!