php - Symfony Secrets are slowing down every page loading
Get the solution ↓↓↓I want to store sensitive API keys inside my Symfony code, so I tried using secrets : Symfony secrets
I installed secrets via composer, and added my two keys : CLIENT_ID, and CLIENT_SECRET, following the instructions of the documentation.
I then added the env variables inside theservices.yaml
file, inside the parameters:
parameters:
clientId: "%env(CLIENT_ID)%"
clientSecret: "%env(CLIENT_SECRET)%"
I then added the variables from the constructor, via the AbstractController to a Service, and tried to get the keys :
public function __construct($clientId, $clientSecret)
{
$this->clientId=$clientId;
$this->clientSecret=$clientSecret;
}
private function performGetRequest()
{
$clientId=$this->clientId;
$clientSecret=$this->clientSecret;
}
I can get the keys, and the API request works, but every page loading takes ages to load (~10s), Symfony Profiler informs me that thecontroller
, is taking all the loading time.
Even when I am removing the request for the variables inside theservices.yaml
file, it is this long. It loads for ages as soon as the variables are stored inside the secrets files. I tried this both in DEV and PROD envs, and it performs the same.
Do you have an idea on how to fix this?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: git was not found in your path, skipping source download
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.