1

Is their any way we can get env variables values in custom script ?

1 Answer 1

0

Have a look at \Magento\Framework\App\DeploymentConfig:

Inject a deployment config object of \Magento\Framework\App\DeploymentConfig in your code and then retrieve the value like this:

$deploymentConfig->get('db/connection/default/host');

For Example:

$deploymentConfig->get('your/custom/value');

Courtesy: Magento 2. Retrieve information from env.php programmatically

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.