Load environment variables from dotenv with v7 and Symfony 6 #2866
Unanswered
ToshY
asked this question in
Help needed
Replies: 2 comments 3 replies
-
Include your autoload.php or use https://deployer.org/docs/7.x/recipe/common#dotenv |
Beta Was this translation helpful? Give feedback.
3 replies
-
For the ones looking for an answer, you will need to manually require the autoloader using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It was suggested to use
deployer/dist
in #2860, but that leaves me with the problem that I don't know how to load enviroment variables from my.env
file properly anymore.Previously in Symfony 5, using
deployer/deployer:v7.0.0-rc.3
, a possible solution was provided here, which was suggesting using symfony/dotenv to load the environment variables.This worked, and while I'm not sure if it was the best solution for the problem at hand, it got the job done.
Now I've tried the suggestion using
deployer/dist:v7.0.0-rc.3
(with Symfony 6), and without knowing/realizing about the possible differences betweendeployer/deployer
anddeployer/dist
, I just tried to see if it worked, resulting in the following error message when trying to display help:Class "Symfony\Component\Dotenv\Dotenv" not found
So now I'm just stuck on what to do next. What is a proper way to load (all) environment variables so I can use them throughout my
deploy.php
?Beta Was this translation helpful? Give feedback.
All reactions